Workbook Merge

  • Thread starter Thread starter itty
  • Start date Start date
I

itty

Hi all,..
I have 26 unsaved woorkbook, with same format and diffrent number o
rows. Can I merge all this 26 workbook into one workbook, one sheet.
Thanks in advance,
Itty..
 
Hi Itty

Try something like this
Copy the code in a normal module

I use the first worksheet in this example

Sub test()
Dim wb As Workbook
Dim lrow As Long
For Each wb In Application.Workbooks
If wb.Name <> ThisWorkbook.Name Then
lrow = LastRow(ThisWorkbook.Sheets(1))
wb.Sheets(1).UsedRange.Copy ThisWorkbook.Sheets(1).Range("A" & lrow + 1)
End If
Next
End Sub

Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top