I am stumped on this-
I have a table and want to filter upon a value in a column and then select visible cells and format with a colored background.
I had gotten similar code to work on a different table and expected this would be easy. I can walk through my code and even see the color being applied...but when it hits the tint and shade line, without any error it reverts to a plain white background (at least from visual inspection).
I grabbed the code that I had got working before and plugged that in- same problem- walking through it, the color change seems to take effect but then it hits the tintand shade line and its gone/no error given.
I commented out the tintandshade lines (see code) and the rest of the formatting comands take effect but the colors arent what I wanted...I wanted the tintandshade values.
code below shows the tintandshade commands commented out- I wasnt using the semi-colon syntax at first, but found it was helpful for troubleshooting
the only thing I am wondering is if I could have some formatting set at the table level that is overriding the cell-level formatting- but I dont know if that is possible. thank you very much if you can explain what I must be missing/misunderstanding...
Becky
I have a table and want to filter upon a value in a column and then select visible cells and format with a colored background.
I had gotten similar code to work on a different table and expected this would be easy. I can walk through my code and even see the color being applied...but when it hits the tint and shade line, without any error it reverts to a plain white background (at least from visual inspection).
I grabbed the code that I had got working before and plugged that in- same problem- walking through it, the color change seems to take effect but then it hits the tintand shade line and its gone/no error given.
I commented out the tintandshade lines (see code) and the rest of the formatting comands take effect but the colors arent what I wanted...I wanted the tintandshade values.
code below shows the tintandshade commands commented out- I wasnt using the semi-colon syntax at first, but found it was helpful for troubleshooting
the only thing I am wondering is if I could have some formatting set at the table level that is overriding the cell-level formatting- but I dont know if that is possible. thank you very much if you can explain what I must be missing/misunderstanding...
Becky
Code:
ActiveSheet.AutoFilterMode = False
Range("Z3").Formula = "=SUBTOTAL(3,TableTPRs[TPR '#])" 'this range is deleted at end of this sub
With ActiveSheet.ListObjects("TableTPRs")
'On Error Resume Next
'Format rows where TPRs are CLOSED
numfield = .ListColumns("State").Index
.Range.AutoFilter Field:=numfield, Criteria1:="Closed"
If Range("Z3").Value > 0 Then
Range("TableTPRs").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = 5: End With '.TintAndShade = 0.399975585192419: End With
End If
.AutoFilter.ShowAllData
'Format rows where TPRs are Resolved / Not Closed
.Range.AutoFilter Field:=numfield, Criteria1:="Resolved / Not Closed"
If Range("Z3").Value > 0 Then
Range("TableTPRs").Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = 4: End With '.TintAndShade = 0.799981688894314: End With
End If
.AutoFilter.ShowAllData
'Format rows where TPRs are Open
.Range.AutoFilter Field:=numfield, Criteria1:="Open"
If Range("Z3").Value > 0 Then
Range("TableTPRs").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
End If
.AutoFilter.ShowAllData
End With