|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
合并表格时去除标题行
test.rar
(45.62 KB, 下载次数: 7)
Sub hztest1()
Dim sh As Worksheet, brr()
Set dic = CreateObject("scripting.dictionary")
x = 1: y = 9
ReDim brr(1 To 1000, 1 To Sheets.Count + 8)
For Each sh In Worksheets
If sh.Name <> ActiveSheet.Name Then
arr = sh.[b1].CurrentRegion
y = y + 1
brr(1, y) = sh.Name & Chr(10) & "????"
For i = 3 To UBound(arr)
ms = arr(i, 2) & arr(i, 3) & arr(i, 4) & arr(i, 5) & arr(i, 6) & arr(i, 7) & arr(i, 8) & arr(i, 9)
If Not dic.exists(ms) Then
x = x + 1
dic(ms) = x
'brr(x, 1) = arr(i, 1): brr(x, 2) = arr(i, 2): brr(x, y) = arr(i, 3)
brr(x, 2) = arr(i, 2): brr(x, 3) = arr(i, 3): brr(x, 4) = arr(i, 4): brr(x, 5) = arr(i, 5): brr(x, 6) = arr(i, 6): brr(x, 7) = arr(i, 7): brr(x, 8) = arr(i, 8): brr(x, 9) = arr(i, 9): brr(x, y) = arr(i, 11)
Else
brr(dic(ms), y) = brr(dic(ms), y) + arr(i, 11)
End If
Next i
End If
Next
With ActiveSheet
.Cells.ClearContents
.[a2].Resize(x, y) = brr
'[a1].Resize(i, 1) = i
[a2].Resize(1, 9) = Array("???", "???????", "????????", "???????", "?????????", "???", "?????????汾", "?????????????", "??λ")
Name = "?????"
End With
End Sub
附件中
|
|