Sub 按地址拆分工作表()
On Error Resume Next
arr = [a1].CurrentRegion
For i = 2 To UBound(arr)
t = Left(arr(i, 2), 3)
Set sh = Sheets(t)
If sh Is Nothing Then
Set sh = Sheets.Add(Sheets(1))
sh.Name = t
End If
j = 2
Do While sh.Cells(j, 1) <> ""
If sh.Cells(j, 1) = arr(i, 1) And sh.Cells(j, 2) = arr(i, 2) Then GoTo 1
j = j + 1
Loop
sh.Cells(j, 1) = arr(i, 1)
sh.Cells(j, 2) = arr(i, 2)
1:
Set sh = Nothing
Next
End Sub来自:求助得到的回答
温馨提示:答案为网友推荐,仅供参考