|
楼主 |
发表于 2019-10-24 08:54
|
显示全部楼层
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' If Target.Column = 1 Then Call 按钮1_Click
Range(Cells(3, 3), Cells([a100000].End(3).Row, 4)).ClearContents
Dim arr
Dim arr1
For i = 3 To [a100000].End(3).Row
arr = Split(Trim(Cells(i, 1)))
arr1 = Split(Trim(Cells(i, 2)))
If UBound(arr1) = 0 Then
If arr(0) = "收" Then
If arr1(0) = "现金" Then
Cells(i, 3) = arr(2)
Else
Cells(i, 4) = arr(2)
End If
End If
If arr(0) = "付" Then
If arr1(0) = "现金" Then
Cells(i, 4) = arr(2)
Else
Cells(i, 4) = arr(2)
End If
End If
End If
Next i
End Sub
老师, 这个代码劳烦您在加一个判断 如果录入错误 弹窗口提示!!
|
|