dougmarkham
Active Member
- Joined
- Jul 19, 2016
- Messages
- 252
- Office Version
- 365
- Platform
- Windows
Hi Folks,
I'm trying to format my dynamic excel table, so that IF text in a cell in column A is colored white, then the entire row--within the table boundary only---will have Interior.ColorIndex = 25.
The only code I've managed to use to successfully change a row within a table to a different interior color (using tablename[header-name] reference type is:
However, if I try and modify
, to for instance
, then this doesn't work and fails to color the correct rows.
I don't understand the syntax
, and I can't find useful hits on Google chrome after multiple searches with different wording.
Would one of you be able to explain this syntax and help me achieve enough understanding to achieve my task?
Kind regards,
Doug.
I'm trying to format my dynamic excel table, so that IF text in a cell in column A is colored white, then the entire row--within the table boundary only---will have Interior.ColorIndex = 25.
The only code I've managed to use to successfully change a row within a table to a different interior color (using tablename[header-name] reference type is:
VBA Code:
Dim LastRow As Long
Dim ColorFlag As Boolean
Dim i As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
ColorFlag = False
For i = 1 To LastRow
If (Cells(i, "D").Value <> Cells(i + 1, "D").Value) Then ColorFlag = Not (ColorFlag)
If (ColorFlag) Then
Range("TotSumTable[Alias/CC/Country]:TotSumTable[Price(£)/Box]").Rows(i).Interior.ColorIndex = 19
Else
Range("TotSumTable[Alias/CC/Country]:TotSumTable[Price(£)/Box]").Rows(i).Interior.ColorIndex = xlNone
End If
Next i
However, if I try and modify
VBA Code:
If (Cells(i, "D").Value <> Cells(i + 1, "D").Value) Then ColorFlag = Not (ColorFlag)
VBA Code:
If (Cells(i, "A").Font.ColorIndex <> 1) Then ColorFlag = Not (ColorFlag)
I don't understand the syntax
VBA Code:
If (Cells(i, "D").Value <> Cells(i + 1, "D").Value) Then ColorFlag = Not (ColorFlag)
Would one of you be able to explain this syntax and help me achieve enough understanding to achieve my task?
Kind regards,
Doug.