|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- .Range("a1:c" & r).Sort key1:=.Range("a1"), order1:=xlAscending, key2:=.Range("b1"), order2:=xlAscending, Header:=xlNo
- For i = 1 To r - 1
- If .Cells(i, 1) = .Cells(i + 1, 1) And .Cells(i, 2) = .Cells(i + 1, 2) Then
- .Cells(i, 3).Resize(2, 1).Merge
- End If
- Next
- End With
- End Sub
复制代码 |
|