shirazsafa
New Member
- Joined
- Nov 29, 2023
- Messages
- 5
- Office Version
- 2003 or older
- Platform
- Windows
hi
Please help me if possible
My formula is not working properly -
Because the range for formatting is variable
When the start of the range is from row 100 onwards.
Because in the formula written in conditional formatting, the address is for the previous rows
The format no longer works
thx . safa
Please help me if possible
My formula is not working properly -
Because the range for formatting is variable
When the start of the range is from row 100 onwards.
Because in the formula written in conditional formatting, the address is for the previous rows
The format no longer works
VBA Code:
Sub formatting()
Dim rng As Range
Dim lr As Long
lr = Sheets("Sheet1").Cells(Rows.Count, 3).End(xlUp).Row - 40
Range("W" & lr).Resize(50, 1).Select
'Suppose this is limited from row 200 to 250
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=AND($G2<>"""";$W2<>"""";$W2<4)"
'Because cell $G2 is mentioned in the formula. And now this cell is not in the area. For this reason, the above formula fails
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With
End Sub
thx . safa
Last edited by a moderator: