Darren Smith
Well-known Member
- Joined
- Nov 23, 2020
- Messages
- 631
- Office Version
- 2019
- Platform
- Windows
With the function below its works fine but how can I make alter it so it will fill row Range A13 to Q last row above Text in column C of the worksheet?
VBA Code:
Sub colorAbove(rng As Range)
Dim brg As Range
Dim rrg As Range
Dim EmptyRowNum As Long
Dim i As Long
For i = 1 To rng.Rows.Count
Set rrg = rng.Rows(i)
If WorksheetFunction.CountA(rrg) = 0 Then
EmptyRowNum = EmptyRowNum + 1
End If
If EmptyRowNum = 2 Then
EmptyRowNum = 0
If brg Is Nothing Then
Set brg = rrg
Else
Set brg = Union(brg, rrg)
End If
End If
Next i
If Not brg Is Nothing Then
brg.Interior.ColorIndex = 36
End If
End Sub