vba 实例
Sub chongxinfenban_ok()
For i = 3 To 9000
yushu = (Cells(i, "t") - 41456) Mod 4 '轧机日期取余数88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Select Case yushu
Case 0
'上工序改班-----------------------下工序原班------------------上工序时间------下工序时间---------下工序改班------上工序改班
If Cells(i, "y") = "丙班" And Cells(i, "p") = "乙班" And Cells(i, "t") = Cells(i, "l") Then Cells(i, "q") = Cells(i, "y"): Cells(i, "q").Font.ColorIndex = 3 '轧机
If Cells(i, "y") = "丁班" And Cells(i, "p") <> "丁班" And Cells(i, "t") = Cells(i, "l") Then Cells(i, "q") = Cells(i, "y"): Cells(i, "q").Font.ColorIndex = 3
Case 1
If Cells(i, "y") = "丁班" And Cells(i, "p") = "丙班" And Cells(i, "t") = Cells(i, "l") Then Cells(i, "q") = Cells(i, "y"): Cells(i, "q").Font.ColorIndex = 3 '轧机
If Cells(i, "y") = "甲班" And Cells(i, "p") <> "甲班" And Cells(i, "t") = Cells(i, "l") Then Cells(i, "q") = Cells(i, "y"): Cells(i, "q").Font.ColorIndex = 3
Case 2
If Cells(i, "y") = "甲班" And Cells(i, "p") = "丁班" And Cells(i, "t") = Cells(i, "l") Then Cells(i, "q") = Cells(i, "y"): Cells(i, "q").Font.ColorIndex = 3 '轧机
If Cells(i, "y") = "乙班" And Cells(i, "p") <> "乙班" And Cells(i, "t") = Cells(i, "l") Then Cells(i, "q") = Cells(i, "y"): Cells(i, "q").Font.ColorIndex = 3
Case 3
If Cells(i, "y") = "乙班" And Cells(i, "p") = "甲班" And Cells(i, "t") = Cells(i, "l") Then Cells(i, "q") = Cells(i, "y"): Cells(i, "q").Font.ColorIndex = 3 '轧机
If Cells(i, "y") = "丙班" And Cells(i, "p") <> "丙班" And Cells(i, "t") = Cells(i, "l") Then Cells(i, "q") = Cells(i, "y"): Cells(i, "q").Font.ColorIndex = 3
End Select
yushu = (Cells(i, "ab") - 41456) Mod 4 '2#剪日期取余数88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Select Case yushu
Case 0
'上工序改班-----------------------下工序原班------------------上工序时间------下工序时间---------下工序改班------上工序改班
If Cells(i, "ag") = "丙班" And Cells(i, "x") = "乙班" And Cells(i, "t") = Cells(i, "ab") Then Cells(i, "y") = Cells(i, "ag"): Cells(i, "y").Font.ColorIndex = 3 '2#剪
If Cells(i, "ag") = "丁班" And Cells(i, "x") <> "丁班" And Cells(i, "t") = Cells(i, "ab") Then Cells(i, "y") = Cells(i, "ag"): Cells(i, "y").Font.ColorIndex = 3
Case 1
If Cells(i, "ag") = "丁班" And Cells(i, "x") = "丙班" And Cells(i, "t") = Cells(i, "ab") Then Cells(i, "y") = Cells(i, "ag"): Cells(i, "y").Font.ColorIndex = 3 '2#剪
If Cells(i, "ag") = "甲班" And Cells(i, "x") <> "甲班" And Cells(i, "t") = Cells(i, "ab") The
n Cells(i, "y") = Cells(i, "ag"): Cells(i, "y").Font.ColorIndex = 3
Case 2
If Cells(i, "ag") = "甲


