ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Copy Worksheet..Howe ?? (https://www.excelbanter.com/excel-worksheet-functions/12185-copy-worksheet-howe.html)

Anthony

Copy Worksheet..Howe ??
 
Hi,

Can anybody give the code to create a macro which will select the entire
contents of worksheet1 (except the headers which are on cells A2:G2) and
paste this onto the next available line on worksheet 2 ??

Easy....uh !!!!!!

thanks/regards
Anthony

Tom Ogilvy

Possibly

Sub Macro1()
Dim rng as Range, rng1 as Range
set rng = Application.UsedRange
set rng1 = Range(Range("A3"),rng)
rng1.copy Destination:=worksheets("sheet2").Range("A2")
End sub

--
Regards,
Tom Ogilvy

"Anthony" wrote in message
...
Hi,

Can anybody give the code to create a macro which will select the entire
contents of worksheet1 (except the headers which are on cells A2:G2) and
paste this onto the next available line on worksheet 2 ??

Easy....uh !!!!!!

thanks/regards
Anthony




Gord Dibben

Anthony

To copy to the first available row, change

rng1.copy Destination:=worksheets("sheet2").Range("A2")

to

rng1.copy Destination:=worksheets("sheet2".Cells(Rows.Count, _
1).End(xlUp).Offset(1, 0)


Gord Dibben Excel MVP

On Tue, 8 Feb 2005 15:34:04 -0500, "Tom Ogilvy" wrote:

Possibly

Sub Macro1()
Dim rng as Range, rng1 as Range
set rng = Application.UsedRange
set rng1 = Range(Range("A3"),rng)
rng1.copy Destination:=worksheets("sheet2").Range("A2")
End sub




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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com