PDA

View Full Version : Solved: How to copy data from one sheet to another



nick99
07-24-2007, 01:27 PM
I know this is a very easy task but i need to know the macro to copy a certain range of data from one sheet to another.
This range is dynamic and changes on a regular basis.

rory
07-24-2007, 02:48 PM
The basic syntax is:
Worksheets("sheet1").Range("Data").Copy Worksheets("Sheet2").Range("A1")
where Data is the name of the range to copy.
Regards,
Rory

nick99
07-25-2007, 10:32 AM
sorry about my lack of VB knowledge, but can you send me the entire code?
Eg:
I need to copy whatever data is from column A to D on sheet 1
and then paste the entire data in sheet 2 as values only.

rory
07-26-2007, 04:00 AM
Off the top of my head, something like this:
Dim lngRows as Long
With Worksheets("sheet1")
lngRows = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("A1:D" & lngRows).Copy
End With
Worksheets("Sheet2").Range("A1").PasteSpecial xlPasteValues

Regards,
Rory

nick99
08-03-2007, 09:56 AM
Thanks