用VBA如何实现
答案:2 悬赏:60 手机版
解决时间 2021-05-05 00:57
- 提问者网友:感性作祟
- 2021-05-04 00:54
用VBA如何实现
最佳答案
- 五星知识达人网友:荒野風
- 2021-05-04 01:56
Sub test()
Dim i, j As Integer
Dim xRng As Range
Dim xStr As String
j = 1
For i = 1 To Range("A9999").End(xlUp).Row
Set xRng = Range("A" & i + 1 & ":A9999")
If InStr(Range("A" & i), "-") Then
xStr = Left(Range("A" & i), InStr(Range("A" & i), "-") + 1)
If WorksheetFunction.CountIf(xRng, xStr & "*") = 0 Then
Range("B" & j) = xStr
j = j + 1
End If
Else
If WorksheetFunction.CountIf(xRng, Range("A" & i)) = 0 Then
Range("B" & j) = Range("A" & i)
j = j + 1
End If
End If
Next i
End Sub
Dim i, j As Integer
Dim xRng As Range
Dim xStr As String
j = 1
For i = 1 To Range("A9999").End(xlUp).Row
Set xRng = Range("A" & i + 1 & ":A9999")
If InStr(Range("A" & i), "-") Then
xStr = Left(Range("A" & i), InStr(Range("A" & i), "-") + 1)
If WorksheetFunction.CountIf(xRng, xStr & "*") = 0 Then
Range("B" & j) = xStr
j = j + 1
End If
Else
If WorksheetFunction.CountIf(xRng, Range("A" & i)) = 0 Then
Range("B" & j) = Range("A" & i)
j = j + 1
End If
End If
Next i
End Sub
全部回答
- 1楼网友:毛毛
- 2021-05-04 03:02
简单.
留下邮箱.
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯