Sub EventClalendar()
Dim ws As Worksheet, Sdate, Edate, r As Range, x, y
With Sheets("campaign calendar")
With .Range("a2").CurrentRegion.Offset(2)
.ClearContents: .Interior.ColorIndex = xlNone
End With
For Each ws In Worksheets
If (ws.Name <> .Name) * (ws.Name <> "master") Then
With ws
With Intersect(.Rows("2:38"), .Range("c1,e1,g1,i1,k1,m1,o1,q1,s1,u1,w1,y1").EntireColumn)
Set r = .Find("*", , , , , 1)
If Not r Is Nothing Then
Sdate = ws.Cells(1, r.Column - 1).Value & ":" & r(1, 0).Value
Set r = .Find("*", .Cells(1), , , , 2)
Edate = ws.Cells(1, r.Column - 1).Value & ":" & r(1, 0).Value
End If
End With
End With
With .Range("a" & Rows.Count).End(xlUp)(2)
.Cells(1).Value = ws.Name
If Not r Is Nothing Then
.Cells(1).Font.Bold = True
x = Application.Match(Split(Sdate, ":")(0) & "*", .Parent.Rows(1), 0)
y = Application.Match(Split(Edate, ":")(0) & "*", .Parent.Rows(1), 0)
.Parent.Range(.Parent.Cells(.Row, x + Split(Sdate, ":")(1) - 1), _
.Parent.Cells(.Row, y + Split(Edate, ":")(1) - 1)).Interior.Color = vbRed
End If
End With
End If
Next
End With
End Sub
Bookmarks