Sub change(ID) Select Case ID Case 101010 With ActiveSheet .Range(B1).Value = 合同号 .Range(C1).Value = 货号 .Range(D1).Value = 品名 End With
Case 10101010 With ActiveSheet .Range(B1).Value = 合同号 .Range(C1).Value = 货号 .Range(D1).Value = 品名 .Range(E1).Value = 盖子 End With
Case 10101011 With ActiveSheet .Range(B1).Value = 合同号 .Range(C1).Value = 货号 .Range(D1).Value = 品名 .Range(E1).Value = 罐底 End With
Case 1010101110 With ActiveSheet .Range(B1).Value = 合同号 .Range(C1).Value = 货号 .Range(D1).Value = 品名 .Range(E1).Value = 罐底 .Range(F1).Value = 制作 End With
Case 101010111010 With ActiveSheet .Range(B1).Value = 合同号 .Range(C1).Value = 货号 .Range(D1).Value = 品名 .Range(E1).Value = 罐底 .Range(F1).Value = 制作 .Range(G1).Value = 制作的单价 End With Case Else With ActiveSheet .Range(B1).Value = .Range(C1).Value = .Range(D1).Value = .Range(E1).Value = .Range(F1).Value = .Range(G1).Value = End With End Select
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Column = 1 Then Call change(ActiveSheet.Range(A1)) End If End Sub