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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("d4")) Is Nothing Then
If [a2] = 1 Then
Application.ScreenUpdating = False
If Target.Text = "ãÈíÚÇÊ" Then '---------------------------
Range("H4").Validation.Delete
Range("H4").Validation.Add Type:=xlValidateList, Formula1:="=seller"
[d5] = Application.WorksheetFunction.Max(Sheet3.Range("b5:b10000")) + 1
End If
If Target.Text = "ãÔÊÑíÇÊ" Then
[a1] = 2
Range("H4").Validation.Delete
Range("H4").Validation.Add Type:=xlValidateList, Formula1:="=buyer"
[d5] = Application.WorksheetFunction.Max(Sheet4.Range("b5:b10000")) + 1
End If
End If
If Target.Text = "ãÈíÚÇÊ" Then [a1] = 3
If Target.Text = "ãÔÊÑíÇÊ" Then [a1] = 2
End If
If Not Intersect(Target, Range("h4:i4")) Is Nothing Then
If Range("d4").Text = "ãÈíÚÇÊ" Then '---------------------------
Range("f5") = Application.WorksheetFunction.VLookup(Target, Sheet1.Range("q5:s5000"), 2, 0)
Range("h5") = Application.WorksheetFunction.VLookup(Target, Sheet1.Range("q5:s5000"), 3, 0)
End If
If Range("d4").Text = "ãÔÊÑíÇÊ" Then '---------------------------
Range("f5") = Application.WorksheetFunction.VLookup(Target, Sheet1.Range("t5:v5000"), 2, 0)
Range("h5") = Application.WorksheetFunction.VLookup(Target, Sheet1.Range("t5:v5000"), 3, 0)
End If
If [h4] = "" Then Range("f5") = ""
If [h4] = "" Then Range("h5") = ""
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("e8:g32,b8:b32,f5,h5")) Is Nothing Then Cells(Target.Row, 1).Select
If Not Intersect(Target, Range("f4")) Is Nothing And [a2] = 1 Then UserForm1.Show
If Not Intersect(Target, Range("f4,h4")) Is Nothing And [a2] = 2 Then Cells(Target.Row, 1).Select
If Not Intersect(Target, Range("d5")) Is Nothing And [a2] = 1 Then Cells(Target.Row, 1).Select
End Sub |
Partager