Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inheriting Format in Excel Cell Reference

Status
Not open for further replies.

Nevermoor

Programmer
Jul 25, 2003
218
US
I have an aggregation workbook, which has a number of worksheets with rows of data like:

Name, value1, value2, . . ., globalsort

globalsort is calculated on these pages to allow ranking in aggregation. As the values change (thereby changing the globalsort value), the subtotal and grand total sheets automatically re-sort. The code I use, called OnChange in the basic sheets, is:
Subtotal Sheet:
Code:
Sub GetAlphaList()
    Cells.Sort Key1:=Range("I2"), Order1:=xlDescending, Header:=xlYes, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
    ThisWorkbook.Worksheets("Aggregate").GetAlphaList
End Sub
Grand Total Sheet:
Code:
Sub GetAlphaList()
    Cells.Sort Key1:=Range("N2"), Order1:=xlDescending, Header:=xlGuess, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortNormal
End Sub

In the past, this code has worked fine. Now, however, the Name value in each of the original worksheets has a background color (unrelated to the data, so no conditional format) that must fill all the way through to the Grand Total sheet.

In the past, I simply put data in via direct reference (i.e. =(Sheet1!A1)) but that loses the name format. I attempted to just copy/paste the names and do the rest via reference as names/format colors are static, and that almost works. The sub-total pages work and re-sort correctly, but the data at the grand total level (which references the sub total page) does not.

Does anyone know how to either reference formatting or fix my sorting problem?

Thanks in advance,
Frank
 




Please post VBA questions in Forum707.

Skip,

[glasses]Have you heard that the roundest knight at King Arthur's round table was...
Sir Cumference![tongue]
 
Sorry. Just posted over there, but I put it here b/c I was hoping there was a simple Excel formula that would copy over the formula.
 




You will have to copy the range in question and paste special FORMATS.

Skip,

[glasses]Have you heard that the roundest knight at King Arthur's round table was...
Sir Cumference![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top