Paste the below code in the module:
Sub gantt_chart()
Dim lastrow, lastcol As Long
lastrow = Range("A65536").End(xlUp).Row
lastcol = Range("A:A").End(xlToRight).Column
Dim i, j As Integer
For j = 5 To lastcol
For i = 2 To lastrow
If Cells(1, j).Value >= Cells(i, 3).Value And Cells(1, j).Value <= Cells(i, 4).Value Then
Cells(i, j).Value = 1
Cells(i, j).Interior.Color = vbRed
Cells(i, j).NumberFormat = ";;;"
Else
Cells(i, j).Value = 0
Cells(i, j).NumberFormat = ";;;"
End If
Next
Next
End Sub
not working
ReplyDelete