当前位置:文档之家› vba 实例

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") Then Cells(i, "y") = Cells(i, "ag"): Cells(i, "y").Font.ColorIndex = 3
Case 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 '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 3
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
End Select
yushu = (Cells(i, "aj") - 41456) Mod 4 '清洗日期取余数88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Select Case yushu
Case 0
'上工序改班-----------------------下工序原班------------------上工序时间------下工序时间---------下工序改班------上工序改班
If Cells(i, "an") = "丙班" And Cells(i, "x") = "乙班" And Cells(i, "t") = Cells(i, "aj") Then Cells(i, "y") = Cells(i, "an"): Cells(i, "y").Font.ColorIndex = 3 '清洗
If Cells(i, "an") = "丁班" And Cells(i, "x") <> "丁班" And Cells(i, "t") = Cells(i, "aj") Then Cells(i, "y") = Cells(i, "an"): Cells(i, "y").Font.ColorIndex = 3
Case 1
If Cells(i, "an") = "丁班" And Cells(i, "x") = "丙班" And Cells(i, "t") = Cells(i, "aj") Then Cells(i, "y") = Cells(i, "an"): Cells(i, "y").Font.ColorIndex = 3 '清洗
If Cells(i, "an") = "甲班" And Cells(i, "x") <> "甲班" And Cells(i, "t") = Cells(i, "aj") Then Cells(i, "y") = Cells(i, "an"): Cells(i, "y").Font.ColorIndex = 3
Case 2
If Cells(i, "an") = "甲班" And Cells(i, "x") = "丁班" And Cells(i, "t") = Cells(i, "aj") Then Cells(i, "y") = Cells(i, "an"): Cells(i, "y").Font.ColorIndex = 3 '清洗
If Cells(i, "an") = "乙班" And Cells(i, "x") <> "乙班" And Cells(i, "t") = Cells(i, "aj") Then Cells(i, "y") = Cells(i, "an"): Cells(i, "y").Font.ColorIndex = 3
Case 3
If Cells(i, "an") = "乙班" And Cells(i, "x") = "甲班" And Cells(i, "t") = Cells(i, "aj") Then Cells(i, "y") = Cells(i, "an"): Cells(i, "y").Font.ColorIndex = 3 '清洗
If Cells(i, "an") = "丙班" And Cells(i, "x") <> "丙班" And Cells(i, "t") = Cells(i, "aj") Then Cells(i, "y") = Cells(i, "an"): Cells(i, "y").Font.ColorIndex = 3
End Select

If Cells(i, "aq") <> 0 Then
yushu = (Cells(i, "aq") - 41456) Mod 4 '退火入炉日期取余数8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Select Case yushu
Case 0
'上工序改班-----------------------下工序原班------------------上工序时间------下工序时间---------下工序改班------上工序改班
If Cells(i, "au") =

"丙班" And Cells(i, "af") = "乙班" And Cells(i, "aq") = Cells(i, "ab") Then Cells(i, "ag") = Cells(i, "au"): Cells(i, "ag").Font.ColorIndex = 3 '退火比2#剪
If Cells(i, "au") = "丁班" And Cells(i, "af") <> "丁班" And Cells(i, "aq") = Cells(i, "ab") Then Cells(i, "ag") = Cells(i, "au"): Cells(i, "ag").Font.ColorIndex = 3
Case 1
If Cells(i, "au") = "丁班" And Cells(i, "af") = "丙班" And Cells(i, "aq") = Cells(i, "ab") Then Cells(i, "ag") = Cells(i, "au"): Cells(i, "ag").Font.ColorIndex = 3 '退火比2#剪
If Cells(i, "au") = "甲班" And Cells(i, "af") <> "甲班" And Cells(i, "aq") = Cells(i, "ab") Then Cells(i, "ag") = Cells(i, "au"): Cells(i, "ag").Font.ColorIndex = 3
Case 2
If Cells(i, "au") = "甲班" And Cells(i, "af") = "丁班" And Cells(i, "aq") = Cells(i, "ab") Then Cells(i, "ag") = Cells(i, "au"): Cells(i, "ag").Font.ColorIndex = 3 '退火比2#剪
If Cells(i, "au") = "乙班" And Cells(i, "af") <> "乙班" And Cells(i, "aq") = Cells(i, "ab") Then Cells(i, "ag") = Cells(i, "au"): Cells(i, "ag").Font.ColorIndex = 3
Case 3
If Cells(i, "au") = "乙班" And Cells(i, "af") = "甲班" And Cells(i, "aq") = Cells(i, "ab") Then Cells(i, "ag") = Cells(i, "au"): Cells(i, "ag").Font.ColorIndex = 3 '退火比2#剪
If Cells(i, "au") = "丙班" And Cells(i, "af") <> "丙班" And Cells(i, "aq") = Cells(i, "ab") Then Cells(i, "ag") = Cells(i, "au"): Cells(i, "ag").Font.ColorIndex = 3
End Select
Else
yushu = (Cells(i, "aq") - 41456) Mod 4 '退火入炉日期取余数8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Select Case yushu
Case 0
'上工序改班-----------------------下工序原班------------------上工序时间------下工序时间---------下工序改班------上工序改班
If Cells(i, "au") = "丙班" And Cells(i, "am") = "乙班" And Cells(i, "aq") = Cells(i, "aj") Then Cells(i, "an") = Cells(i, "au"): Cells(i, "an").Font.ColorIndex = 3 '退火比清洗
If Cells(i, "au") = "丁班" And Cells(i, "am") <> "丁班" And Cells(i, "aq") = Cells(i, "aj") Then Cells(i, "an") = Cells(i, "au"): Cells(i, "an").Font.ColorIndex = 3
Case 1
If Cells(i, "au") = "丁班" And Cells(i, "am") = "丙班" And Cells(i, "aq") = Cells(i, "aj") Then Cells(i, "an") = Cells(i, "au"): Cells(i, "an").Font.ColorIndex = 3 '退火比清洗
If Cells(i, "au") = "甲班" And Cells(i, "am") <> "甲班" And Cells(i, "aq") = Cells(i, "aj") Then Cells(i, "an") = Cells(i, "au"): Cells(i, "an").Font.ColorIndex = 3
Case 2
If Cells(i, "au") = "甲班" And Cells(i, "am") = "丁班" And Cells(i, "aq") = Cells(i, "aj") Then Cells(i, "an") = Cells(i, "au"): Cells(i, "an").Font.ColorIndex = 3 '退火比清洗
If Cells(i, "au") = "乙班" And Cells(i, "am") <> "乙班" And Cells(i, "aq") = Cells(i, "aj")

Then Cells(i, "an") = Cells(i, "au"): Cells(i, "an").Font.ColorIndex = 3
Case 3
If Cells(i, "au") = "乙班" And Cells(i, "am") = "甲班" And Cells(i, "aq") = Cells(i, "aj") Then Cells(i, "an") = Cells(i, "au"): Cells(i, "an").Font.ColorIndex = 3 '退火比清洗
If Cells(i, "au") = "丙班" And Cells(i, "am") <> "丙班" And Cells(i, "aq") = Cells(i, "aj") Then Cells(i, "an") = Cells(i, "au"): Cells(i, "an").Font.ColorIndex = 3
End Select
End If

yushu = (Cells(i, "ar") - 41456) Mod 4 '退火出炉日期取余数88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Select Case yushu
Case 0
'上工序改班-----------------------下工序原班------------------上工序时间------下工序时间---------下工序改班------上工序改班
If Cells(i, "av") = "丙班" And Cells(i, "bd") = "丁班" And Cells(i, "ar") = Cells(i, "az") Then Cells(i, "be") = Cells(i, "av"): Cells(i, "be").Font.ColorIndex = 3 '精整
If Cells(i, "av") = "乙班" And Cells(i, "bd") <> "乙班" And Cells(i, "ar") = Cells(i, "az") Then Cells(i, "be") = Cells(i, "av"): Cells(i, "be").Font.ColorIndex = 3
Case 1
If Cells(i, "av") = "丁班" And Cells(i, "bd") = "甲班" And Cells(i, "ar") = Cells(i, "az") Then Cells(i, "be") = Cells(i, "av"): Cells(i, "be").Font.ColorIndex = 3 '精整
If Cells(i, "av") = "丙班" And Cells(i, "bd") <> "丙班" And Cells(i, "ar") = Cells(i, "az") Then Cells(i, "be") = Cells(i, "av"): Cells(i, "be").Font.ColorIndex = 3
Case 2
If Cells(i, "av") = "甲班" And Cells(i, "bd") = "乙班" And Cells(i, "ar") = Cells(i, "az") Then Cells(i, "be") = Cells(i, "av"): Cells(i, "be").Font.ColorIndex = 3 '精整
If Cells(i, "av") = "丁班" And Cells(i, "bd") <> "丁班" And Cells(i, "ar") = Cells(i, "az") Then Cells(i, "be") = Cells(i, "av"): Cells(i, "be").Font.ColorIndex = 3
Case 3
If Cells(i, "av") = "乙班" And Cells(i, "bd") = "丙班" And Cells(i, "ar") = Cells(i, "az") Then Cells(i, "be") = Cells(i, "av"): Cells(i, "be").Font.ColorIndex = 3 '精整
If Cells(i, "av") = "甲班" And Cells(i, "bd") <> "甲班" And Cells(i, "ar") = Cells(i, "az") Then Cells(i, "be") = Cells(i, "av"): Cells(i, "be").Font.ColorIndex = 3
End Select
yushu = (Cells(i, "az") - 41456) Mod 4 '精整日期取余数888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Select Case yushu
Case 0
'上工序改班-----------------------下工序原班------------------上工序时间------下工序时间---------下工序改班------上工序改班
If Cells(i, "be") = "丙班" And Cells(i, "bl") = "丁班" And Cells(i, "az") = Cells(i, "bh") Then Cells(i, "bm") = Cells(i, "be"): Cells(i, "bm").Font.ColorIndex = 3 '拉矫机
If Cells(i, "be") = "乙班" And Cells(i, "bl") <> "乙班" And Cell

s(i, "az") = Cells(i, "bh") Then Cells(i, "bm") = Cells(i, "be"): Cells(i, "bm").Font.ColorIndex = 3
Case 1
If Cells(i, "be") = "丁班" And Cells(i, "bl") = "甲班" And Cells(i, "az") = Cells(i, "bh") Then Cells(i, "bm") = Cells(i, "be"): Cells(i, "bm").Font.ColorIndex = 3 '拉矫机
If Cells(i, "be") = "丙班" And Cells(i, "bl") <> "丙班" And Cells(i, "az") = Cells(i, "bh") Then Cells(i, "bm") = Cells(i, "be"): Cells(i, "bm").Font.ColorIndex = 3
Case 2
If Cells(i, "be") = "甲班" And Cells(i, "bl") = "乙班" And Cells(i, "az") = Cells(i, "bh") Then Cells(i, "bm") = Cells(i, "be"): Cells(i, "bm").Font.ColorIndex = 3 '拉矫机
If Cells(i, "be") = "丁班" And Cells(i, "bl") <> "丁班" And Cells(i, "az") = Cells(i, "bh") Then Cells(i, "bm") = Cells(i, "be"): Cells(i, "bm").Font.ColorIndex = 3
Case 3
If Cells(i, "be") = "乙班" And Cells(i, "bl") = "丙班" And Cells(i, "az") = Cells(i, "bh") Then Cells(i, "bm") = Cells(i, "be"): Cells(i, "bm").Font.ColorIndex = 3 '拉矫机
If Cells(i, "be") = "甲班" And Cells(i, "bl") <> "甲班" And Cells(i, "az") = Cells(i, "bh") Then Cells(i, "bm") = Cells(i, "be"): Cells(i, "bm").Font.ColorIndex = 3
End Select
yushu = (Cells(i, "bh") - 41456) Mod 4 '拉矫机日期取余数888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
Select Case yushu
Case 0
'上工序改班-----------------------下工序原班------------------上工序时间------下工序时间---------下工序改班------上工序改班
If Cells(i, "bm") = "丙班" And Cells(i, "bs") = "丁班" And Cells(i, "bh") = Cells(i, "bp") Then Cells(i, "bt") = Cells(i, "bm"): Cells(i, "bt").Font.ColorIndex = 3 '成品剪
If Cells(i, "bm") = "乙班" And Cells(i, "bs") <> "乙班" And Cells(i, "bh") = Cells(i, "bp") Then Cells(i, "bt") = Cells(i, "bm"): Cells(i, "bt").Font.ColorIndex = 3
Case 1
If Cells(i, "bm") = "丁班" And Cells(i, "bs") = "甲班" And Cells(i, "bh") = Cells(i, "bp") Then Cells(i, "bt") = Cells(i, "bm"): Cells(i, "bt").Font.ColorIndex = 3 '成品剪
If Cells(i, "bm") = "丙班" And Cells(i, "bs") <> "丙班" And Cells(i, "bh") = Cells(i, "bp") Then Cells(i, "bt") = Cells(i, "bm"): Cells(i, "bt").Font.ColorIndex = 3
Case 2
If Cells(i, "bm") = "甲班" And Cells(i, "bs") = "乙班" And Cells(i, "bh") = Cells(i, "bp") Then Cells(i, "bt") = Cells(i, "bm"): Cells(i, "bt").Font.ColorIndex = 3 '成品剪
If Cells(i, "bm") = "丁班" And Cells(i, "bs") <> "丁班" And Cells(i, "bh") = Cells(i, "bp") Then Cells(i, "bt") = Cells(i, "bm"): Cells(i, "bt").Font.ColorIndex = 3
Case 3
If Cells(i, "bm") = "乙班" And Cells(i, "bs") = "丙班" And Cells(i, "bh") = Cells(i, "bp") Then Cells(i, "bt") = Cells(i, "bm"): Cells(i, "bt").Font.ColorIndex = 3 '成品剪
If Cells(i, "bm") = "

甲班" And Cells(i, "bs") <> "甲班" And Cells(i, "bh") = Cells(i, "bp") Then Cells(i, "bt") = Cells(i, "bm"): Cells(i, "bt").Font.ColorIndex = 3

End Select
Next





End Sub



相关主题
文本预览
相关文档 最新文档