1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
Sub SetColor() Set w = Sheets("Sheet1") For Each c In Split("2,3,17,23,24,38,39", ",") alphabet = Split(w.Cells(1, CInt(c)).Address, "$")(1) For r = 2 To 300 Set f = w.Cells(r, CInt(c)).FormatConditions.Add(xlExpression, xlEqual, "=" & alphabet & r & "=""未""") f.Font.Color = RGB(255, 0, 0) f.Interior.Color = RGB(255, 255, 0) f.StopIfTrue = False Set f = w.Cells(r, CInt(c)).FormatConditions.Add(xlExpression, xlEqual, "=" & alphabet & r & "=""済み""") f.Font.Color = RGB(0, 0, 0) f.Interior.Color = RGB(150, 150, 150) f.StopIfTrue = False Next Next End Sub |