Nerdalert314
New Member
- Joined
- Mar 28, 2018
- Messages
- 23
Hello all!
I am trying to use and If statement with a table. If eligibility is before today and if complete says no I am wanting to highlight. My problem is when there is nothing to highlight it is highlighting the whole table. It is not proceeding on to the else statement. On another table I am wanting to highlight anything for this month and next month that says no. Same problem when nothing says no. Any help would be appreciated! .... I do have some repetitive stuff in there trying to get this to work. I am very new to even reading code so don't expect this to be correct.
I am trying to use and If statement with a table. If eligibility is before today and if complete says no I am wanting to highlight. My problem is when there is nothing to highlight it is highlighting the whole table. It is not proceeding on to the else statement. On another table I am wanting to highlight anything for this month and next month that says no. Same problem when nothing says no. Any help would be appreciated! .... I do have some repetitive stuff in there trying to get this to work. I am very new to even reading code so don't expect this to be correct.
Code:
[COLOR=#0000ff]ActiveSheet.ListObjects("Table3").Range.AutoFilter Field:=4, Criteria1:= _
"<=" & Date, Operator:=xlAnd
If Evaluate(WorksheetFunction.CountIf(Range("C1:C3000"), "NO")) > 0 Then
ActiveSheet.ListObjects("Table3").Range.AutoFilter Field:=3, Criteria1:= _
"=NO"
Range("Table3").Select
Selection.Style = "Accent4"
ActiveSheet.ListObjects("Table3").Range.AutoFilter Field:=3
Columns("A:A").Select
With Selection
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("A:A").Select
With Selection.Interior
.PatternThemeColor = xlThemeColorAccent3
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Range("Table3").Select
With Selection.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ActiveSheet.ListObjects("Table3").Range.AutoFilter Field:=3
ActiveSheet.ListObjects("Table3").Range.AutoFilter Field:=4
Range("B2").Select
Else
ActiveSheet.ListObjects("Table3").Range.AutoFilter Field:=3
ActiveSheet.ListObjects("Table3").Range.AutoFilter Field:=4
Range("B2").Select
End If[/COLOR]