Copy from file1 sheet1/file2 sheet1 last blank row

T

Tasha

GCan someone please help me? I've looked at all the posts here regarding
doing this, but they don't seem to apply to what I want to do.

I need to copy all data except column headings in row 1 from workbook1,
Sheet1(consists of data in columns A-G and rows will vary by day) to
workbook2, Sheet1 in the last blank row available. Both files have the same
type of data, am just appending to workbook 1 daily. I've been doing this
manually, but know there has to be an easier way. Is there a way to do this
without opening workbook2? If not, that's fine, just thought I would see.
Thank you so much for your help!!!
 
P

Pranav Vaidya

Hi Tasha,

Use the below macro. You can copy this in the source workbook from where you
want the data to be copied-

Dim myRange As Range
Dim mLastRow As Integer
Dim tLastRow As Integer
'find the last row in the current workbook
mLastRow = Range("A65000").End(xlUp).Row
'set the range to copy
Set myRange = Range("A2:G" & mLastRow)
'copy the data
myRange.Copy
'Open the target workbook
Workbooks.Open "C:\Test2.xls"
'Select the target worksheet
Sheets("Sheet1").Select
'find the last row to copy
tLastRow = Range("A65000").End(xlUp).Row + 1
'select the target cell
Range("A" & tLastRow).Select
'Copy the data
ActiveSheet.Paste
'close the target workbook with save changes
ActiveWorkbook.Close yes

This macro is tested and with inline comments to guide you.
Hope this helps.
 
T

Tasha

Oh my Gosh, it works perfect!! I cannot thank you enough!!! And I really
really appreciate the play by play through the macro....I retain more when I
know what it is I am actually doing!!!
 

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

Top