|
求教大家,红色代码具体含义是什么,尽量说的直白点,非常感谢。
Private Sub Worksheet_Change(ByVal Target As Range)
Dim RowsNo, Arr, D, I&, Cel, Prompt
Application.EnableEvents = False '停用事件的代码
RowsNo = Worksheets("会员提成").Shapes("新增一行").TopLeftCell.Row - 1
Arr = Worksheets("送网费").Range("F2:F" & [F2].End(4).Row)
Set D = CreateObject("scripting.dictionary")
For I = 1 To UBound(Arr) '循环A列
If Not Arr(I, 1) = 0 And Not Arr(I, 1) = "" Then
D(Replace(Arr(I, 1), " ", "")) = ""
End If
Next
For Each Cel In Range(Cells(2, 2), Cells(RowsNo, 2))
If D.exists(Replace(Cel.Value, " ", "")) Then
Prompt = MsgBox("身份证号“" & Cel & "”已参与送网费,不得再算提成!")
Range(Cells(RowsNo, 1), Cells(RowsNo, 3)).ClearContents
End If
Next
Worksheets("交班表").Cells(5, 6) = Application.Count(Range(Cells(2, 3), Cells(RowsNo, 3)))
Application.EnableEvents = True '启用事件的代码
End Sub
|
|