Darren Smith
Well-known Member
- Joined
- Nov 23, 2020
- Messages
- 631
- Office Version
- 2019
- Platform
- Windows
I need to delete color from 2 sheets with the same command button.
How is this possible with my code?
How is this possible with my code?
VBA Code:
Private Sub Delete_Color()
Dim ws As Worksheet
Dim rng As Range
For Each ws In ThisWorkbook.Worksheets.Count
If ws.Name <> Trim("Job Card Master") Then
ws.Range("A13:Q61").Cells.Interior.Color = xlNone
ws.Range("A66:Q122").Cells.Interior.Color = xlNone
ws.Range("A127:Q183").Cells.Interior.Color = xlNone
ws.Range("A188:Q244").Cells.Interior.Color = xlNone
ws.Range("A249:Q299").Cells.Interior.Color = xlNone
rng.Font.ColorIndex = 1
rng.Font.Italic = False
rng.Font.Bold = False
End If
If ws.Name <> Trim("Job Card with Time Analysis") Then
ws.Range("A13:Q61").Cells.Interior.Color = xlNone
ws.Range("A66:Q122").Cells.Interior.Color = xlNone
ws.Range("A127:Q183").Cells.Interior.Color = xlNone
ws.Range("A188:Q244").Cells.Interior.Color = xlNone
ws.Range("A249:Q299").Cells.Interior.Color = xlNone
rng.Font.ColorIndex = 1
rng.Font.Italic = False
rng.Font.Bold = False
End If
Next ws
End Sub