#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macros

Hello,

How do I make a macro that copies data from one spreadsheet and then pastes
it into another spreadsheet, BUT does not paste over the top of the existing
data and pastes a row lower?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Macros

Hi Burg,

The following copies A1:D6 on Sheet1 to a range on Sheet2 starting at the
next empty cell in column A.

Sub Demo()
Dim srcRng As Range, destRng As Range

Set srcRng = Sheets("Sheet1").Range("A1:D6")
Set destRng = Sheets("Sheet2"). _
Cells(Rows.Count, "A").End(xlUp)(2)

srcRng.Copy destRng
End Sub

---
Regards,
Norman



"burg" wrote in message
...
Hello,

How do I make a macro that copies data from one spreadsheet and then
pastes
it into another spreadsheet, BUT does not paste over the top of the
existing
data and pastes a row lower?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macros

Thanks Norman,

Just wondering how you specify a file path. I want to paste the data into
another spreadsheet. It is in the same folder so does this make it easier?

Thanks
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Macros

Hi Burg,

Try something like:

Sub Demo02()
Dim srcRng As Range, destRng As Range
Dim WB1 As Workbook, WB2 As Workbook

Set WB1 = Workbooks("MySourceBook.xls")
Set WB2 = Workbooks("MyDestinationBook.xls")
Set srcRng = WB1.Sheets("Sheet1").Range("A1:D6")
Set destRng = WB2.Sheets("Sheet1"). _
Cells(Rows.Count, "A").End(xlUp)(2)

srcRng.Copy destRng
End Sub


---
Regards,
Norman



"burg" wrote in message
...
Thanks Norman,

Just wondering how you specify a file path. I want to paste the data into
another spreadsheet. It is in the same folder so does this make it easier?

Thanks



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macros

Perfect. Thanks

"Norman Jones" wrote:

Hi Burg,

Try something like:

Sub Demo02()
Dim srcRng As Range, destRng As Range
Dim WB1 As Workbook, WB2 As Workbook

Set WB1 = Workbooks("MySourceBook.xls")
Set WB2 = Workbooks("MyDestinationBook.xls")
Set srcRng = WB1.Sheets("Sheet1").Range("A1:D6")
Set destRng = WB2.Sheets("Sheet1"). _
Cells(Rows.Count, "A").End(xlUp)(2)

srcRng.Copy destRng
End Sub


---
Regards,
Norman



"burg" wrote in message
...
Thanks Norman,

Just wondering how you specify a file path. I want to paste the data into
another spreadsheet. It is in the same folder so does this make it easier?

Thanks






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert lotus 123w macros to excel macros rpiescik[_2_] Excel Programming 1 September 19th 04 12:41 PM
convert lotus 123w macros to excel macros rpiescik Excel Programming 1 September 18th 04 01:35 PM
Open workbook-macros enabled, opening another with macros George J Excel Programming 5 September 17th 04 02:07 PM
Macro Size Limit / open macros with macros? andycharger[_7_] Excel Programming 6 February 13th 04 02:00 PM
Macros not appearing in the Tools Macro Macros list hglamy[_2_] Excel Programming 5 October 24th 03 09:10 AM


All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"