kmmsquared
New Member
- Joined
- Jan 7, 2011
- Messages
- 33
Hello,
I am using the following code below to filter a column and color the rows of that contain cells with the correct values (this occurs 3x in my code). My problem is the if e is nothing then the column still colors. I only want the rows to be colored if e is not nothing. Any suggestions would be greatly appreciated-there is probably something simple that I can't think of. Thanks!
I am using the following code below to filter a column and color the rows of that contain cells with the correct values (this occurs 3x in my code). My problem is the if e is nothing then the column still colors. I only want the rows to be colored if e is not nothing. Any suggestions would be greatly appreciated-there is probably something simple that I can't think of. Thanks!
Code:
With Sheets("Sheet1")
lngLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
s = Application.WorksheetFunction.Match("Esc", Range("1:1"), 0)
e = Range("E2:E" & lngLastRow).SpecialCells(xlCellTypeVisible)
Columns("E").AutoFilter Field:=1, Criteria1:="MAKE"
[COLOR=red]If Not e Is Nothing Then
Range(Cells(2, 1), Cells(lngLastRow, s)).SpecialCells(xlCellTypeVisible).Activate
With Selection.Interior
.ThemeColor = xlThemeColorAccent5
.TintAndShade = 0.599993896298105
End With
[/COLOR]End If