Pagi semua.
Saya mendapatkan kesulitan untuk menggabungkan sheet. Mohon bantuannya ya.
If Left(W.Name, 4) <> "comb" Then
Set MoveTbl = W.Cells(6).CurrentRegion.Offset(6, 0)
Set MoveTbl = MoveTbl.Resize(MoveTbl.Rows.Count - 1,
MoveTbl.Columns.Count)
tRows = MoveTbl.Rows.Count
Urutan = Urutan & W.Name & vbTab & vbTab & tRows & vbCrLf
MoveTbl.Copy Destination:=DestRange
Set DestRange = DestRange.Offset(tRows, 0)
Arti dari Set MoveTbl = MoveTbl.Resize(MoveTbl.Rows.Count - 1
apa ya?tabel yang akan saya copy mulai dari A7, jadi Set MoveTbl =
W.Cells(6).CurrentRegion.Offset(6, 0)
Dengan code diatas yang tercopy cuma 1 baris A7 aja dari 12 sheet
Melihat contoh :
Sub GabungTabelSheet()
Dim W As Worksheet, Urutan As String
Dim MoveTbl As Range, DestRange As Range
Dim N As Long, tRows As Long
Const msg As String = "Penggabungan Selesai." & vbCrLf & vbCrLf & _
"SheetName: | RowsCount:" & vbCrLf
Set DestRange = Sheets("combine").Range("A2")
N = 0
For Each W In Worksheets
If Left(W.Name, 4) <> "comb" Then
Set MoveTbl = W.Cells(1).CurrentRegion.Offset(1, 0)
Set MoveTbl = MoveTbl.Resize(MoveTbl.Rows.Count - 1,
MoveTbl.Columns.Count)
tRows = MoveTbl.Rows.Count
Urutan = Urutan & W.Name & vbTab & vbTab & tRows & vbCrLf
MoveTbl.Copy Destination:=DestRange
Set DestRange = DestRange.Offset(tRows, 0)
N = N + CLng(tRows)
End If
Next W
Application.CutCopyMode = False
MsgBox msg & Urutan & "Total Rows digabung: " & N, vbInformation,
"LAPORAN...:"
End Sub
contoh ini pas di run macronya smua tercopy dan jika saya tambah 1 baris dan
saya run ulang baris itu jg ikut tercopy.
Mohon bantuannya ya?
Terima Kasih
Dioni