Hello!
I am trying to write a macro to loop through a bunch of worksheets and will perform another set of loops if a condition is met.
Here is my macro so far:
Sub test()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If IsEmpty(range("a1").Value) = False Then 'If range A1 is /not/ empty, then perform these loops
Dim c As range
range("d3:x115").Name = "Rng"
For Each c In range("Rng")
If c.Interior.Color = RGB(166, 77, 121) Then 'If it’s colored then
If c Like "*#*" Then c.Offset(, 5) = c + 1 'check if has a date entered
If c.Offset(, 5).Interior.ColorIndex = xlNone Then c.Offset(28, -20) = c + 3 'if no fill then go to next week
End If
Next
range("d143").ClearContents
On Error Resume Next 'If range A1 /is/ empty, then go to the next worksheet
End If
Next ws
End Sub
As of now, everything functions perfectly, except it only performs the loops on one worksheet and not through all of them. I need it to check if the active worksheet has text in cell A1, and if it does, then to perform the loops through "Rng". Whether or not A1 has text, it should go to the next worksheet after everything is done.
Any ideas?
Bookmarks