PC Review


Reply
Thread Tools Rate Thread

Copy from file1 sheet1/file2 sheet1 last blank row

 
 
=?Utf-8?B?VGFzaGE=?=
Guest
Posts: n/a
 
      22nd Aug 2007
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!!!
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UHJhbmF2IFZhaWR5YQ==?=
Guest
Posts: n/a
 
      22nd Aug 2007
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.
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Tasha" wrote:

> 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!!!

 
Reply With Quote
 
=?Utf-8?B?VGFzaGE=?=
Guest
Posts: n/a
 
      22nd Aug 2007
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!!!

"Pranav Vaidya" wrote:

> 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.
> --
> Pranav Vaidya
> VBA Developer
> PN, MH-India
> If you think my answer is useful, please rate this post as an ANSWER!!
>
>
> "Tasha" wrote:
>
> > 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!!!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upload Data from Sheet1 on Local Machine to Sheet1 on LAN ryguy7272 Microsoft Excel Programming 2 3rd Jul 2008 08:40 PM
VBA Code to Open File1; Open File2 copy sheets to File1 =?Utf-8?B?RGVubmlz?= Microsoft Excel Misc 5 18th Oct 2004 12:19 AM
locate a value from file1 in file2 Gary Microsoft Excel Programming 6 11th Mar 2004 05:49 PM
Show a sheet1 row in sheet2 based on values in col sheet1.A =?Utf-8?B?TWljaGVsbGU=?= Microsoft Excel Misc 5 4th Mar 2004 02:52 PM
Copy Data to Sheet2 if cell in Sheet1 is not blank ph6971 Microsoft Excel Worksheet Functions 1 10th Nov 2003 03:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:26 AM.