|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
我能看懂的 就是按照税率来拆分 其他的不知道
Sub test()
Dim arr
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set d = CreateObject("scripting.dictionary")
With Worksheets("sheet1")
r = .Cells(.Rows.Count, 1).End(xlUp).Row
arr = .Range("a1:g" & r)
For i = 2 To UBound(arr)
If Not d.exists(arr(i, 5)) Then
Set d(arr(i, 5)) = .Range("a1").Resize(1, 7)
End If
Set d(arr(i, 5)) = Union(d(arr(i, 5)), .Cells(i, 1).Resize(1, 7))
Next
End With
With Worksheets("sheet3")
.Cells.Clear
For Each aa In d.keys
If .Cells(1, 1) = "" Then
r = 1
Else
r = .[a65536].End(xlUp).Row + 2
End If
d(aa).Copy .Range("a" & r)
Next
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
MsgBox "数据拆分完毕!", vbInformation
End Sub
|
|