Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Help: Dynamic Range
I need help changing the: For Each rng In Range("B2:B5000") to a dynamic
statement that looks for the last column/row used in the sheet. Thanks in advance for the help. Sub Green_Bar() Dim rng As Range Dim OldVal As Variant Dim Gray As Boolean Gray = True OldVal = Range("B2").Value For Each rng In Range("B2:B5000") ' WANT TO BE ABLE TO MAKE THIS DYNAMIC If rng.Value = OldVal Then If Gray Then rng.EntireRow.Interior.ColorIndex = 2 Else rng.EntireRow.Interior.ColorIndex = 4 End If Else OldVal = rng.Value Gray = Not Gray If Gray Then rng.EntireRow.Interior.ColorIndex = 2 Else rng.EntireRow.Interior.ColorIndex = 4 End If End If Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dynamic range | Excel Worksheet Functions | |||
Dynamic Range | Excel Worksheet Functions | |||
Dynamic range | Excel Discussion (Misc queries) | |||
Dynamic Range with unused formula messing up x axis on dynamic graph | Charts and Charting in Excel | |||
Excel 2000 VBA - Set Print Range in dynamic range | Excel Programming |