|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Column = 2 And Target.Row > 2 Then
- r = Target.Row
- If Target <> "" Then
- Cells(r, "e") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- Else
- Cells(r, "e") = ""
- End If
- End If
- 'If Target.Column = 12 And Target.Row > 3 Then
- 'r = Target.Row
- 'a = Target.Column
- 'If Target = "拆解","定损","备件","机电待修","机电修","钣金待修","钣金修","待前处理","前处理","喷底漆","底漆打磨","待喷漆","喷漆","钣金待装","钣金装","待抛光","抛光","待交车","返修","完工" Then
- 'Cells(r, a + 12) = Format(Now, "yyyy-mm-dd hh:mm:ss")
- 'End If
- 'End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "拆解" Then
- Cells(r, "m") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "定损" Then
- Cells(r, "n") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "备件" Then
- Cells(r, "o") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "机电待修" Then
- Cells(r, "p") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "机电修" Then
- Cells(r, "q") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "钣金待修" Then
- Cells(r, "r") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "钣金修" Then
- Cells(r, "s") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "待前处理" Then
- Cells(r, "t") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "前处理" Then
- Cells(r, "u") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "喷底漆" Then
- Cells(r, "v") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "底漆打磨" Then
- Cells(r, "w") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "待喷漆" Then
- Cells(r, "x") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "喷漆" Then
- Cells(r, "y") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "钣金待装" Then
- Cells(r, "z") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "钣金装" Then
- Cells(r, "aa") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "待抛光" Then
- Cells(r, "ab") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "抛光" Then
- Cells(r, "ac") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "待交车" Then
- Cells(r, "ad") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "返修" Then
- Cells(r, "ae") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- If Target.Column = 12 And Target.Row > 3 Then
- r = Target.Row
- If Target = "完工" Then
- Cells(r, "af") = Format(Now, "yyyy-mm-dd hh:mm:ss")
- End If
- End If
- 100:
- Application.EnableEvents = True
- End Sub
复制代码 中间工序可能跳过,但需要将时间显示在各自固定区域,跳过的工序不显示时间。
|
|