Rx_
Nothing In Moderation
- Local time
- Today, 01:40
- Joined
- Oct 22, 2009
- Messages
- 2,803
The following works to add a conditional format.
The Date in Column J will turn green if the number in Column K is greater than 1.
The imported data from MSAccess starts on Row 6 and can have different amounts of rows depending on the query.
This code works. Just wondering if anyone knows how to use the Offset method? It is the line commented out.
I might want to put a variable in there to make my formula more universal.
The Date in Column J will turn green if the number in Column K is greater than 1.
The imported data from MSAccess starts on Row 6 and can have different amounts of rows depending on the query.
This code works. Just wondering if anyone knows how to use the Offset method? It is the line commented out.
I might want to put a variable in there to make my formula more universal.
Code:
Sub RxConditionalFormat()
With Sheets(1)
Application.Goto .Range("J6")
With .Range("J6:J" & .Range("A" & .Rows.Count).End(xlUp).Row)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=K6>1"
'.FormatConditions.Add Type:=xlExpression, Formula1:="=ActiveCell.Offset(-1, 0) > 1"
With Selection.FormatConditions(1).Font
.ThemeColor = xlThemeColorAccent3
.TintAndShade = -0.249946592608417
End With
.FormatConditions(1).StopIfTrue = True
End With
End With
End Sub