Darren Smith
Well-known Member
- Joined
- Nov 23, 2020
- Messages
- 631
- Office Version
- 2019
- Platform
- Windows
I need to insert color into 2 sheets with the same command button.
How is this possible with my code?
How is this possible with my code?
VBA Code:
Sub colorAbove(rng As Range)
Dim i As Long, rrg As Range
Dim ws As Worksheets
For Each ws In ThisWorkbook.Worksheets(Array("Job Card Master", "Job Card with Time Analysis"))
For i = 1 To rng.Rows.Count
Set rrg = rng.Rows(i)
If WorksheetFunction.CountA(rrg) = 0 Then
If rrg.Offset(1).Cells(3) <> "" Then
rrg.Interior.ColorIndex = 36
End If
End If
Next i
Next ws
End Sub