excel VBA 自动绘制甘特图

时间:2024-03-04 20:08:30

EXCEL 自动数值匹配颜色自动填充

Dim i, j As Integer
Dim str As String
Range("H8:BI89") = Sheet1.Cells(2, "F")
Range("H8:BI89").Interior.ColorIndex = 0
For i = 8 To 89
str = Sheet1.Cells(i, "F")
If (Not IsEmpty(str)) Then
For j = 9 To 61
If Cells(3, j) = str Then
Cells(i, j).Value = str
Cells(i, j).Interior.Color = Sheet1.Cells(i, "D").Interior.Color
End If
Next
End If
Next