代码如下。。。
Sub 填充()
Set d = CreateObject("scripting.dictionary")
arr = [a4].CurrentRegion
For i = 2 To UBound(arr)
If arr(i, 4) = "" Then
If IsNumeric(Right(arr(i, 3), 1)) Then
If arr(i, 4) = arr(i + 1, 4) Then
arr(i, 4) = 1111111111: arr(i + 1, 4) = --"7777777777"
If InStr(arr(i, 3), "费") Then arr(i, 4) = --"2222222222": arr(i + 1, 4) = --"7777777777"
If InStr(arr(i, 3), "租赁") Then arr(i, 4) = --"3333333333": arr(i + 1, 4) = --"7777777777"
End If
End If
End If
Next
[a4].Resize(UBound(arr), UBound(arr, 2)) = arr
Set d = Nothing
End Sub |