|
本来按字段合并已经写好了,上传前突然发现工作表复制是连标题一起复制的,所以,又重新写了一个。- Sub ykcbf() '//2024.5.27
- Set sh = ThisWorkbook.Sheets("某某车企汇总")
- For Each sht In Sheets
- If sht.Name <> sh.Name Then
- If IsArray(sht.UsedRange) Then
- m = m + 1
- With sht
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .UsedRange.Columns.Count
- arr = .[a1].Resize(r, c)
- End With
- If m = 1 Then
- sh.[a1].Resize(UBound(arr), UBound(arr, 2)) = arr
- Else
- r = sh.Cells(Rows.Count, 1).End(3).Row
- sh.Cells(r + 1, 1).Resize(UBound(arr), UBound(arr, 2)) = arr
- End If
- End If
- End If
- Next
- MsgBox "OK!"
- End Sub
复制代码
|
|