Counting down the number of cells moved


Posted by Chris on April 03, 2001 2:03 PM

Hi folks,
What i need to know is this: I have to copy an indeffinate range of Data. What stays contstant are the number of columns and the top row will not be copied, thats the database headings. This indefinate range of data has to be copied to another worksheet, 'Authorised', which has a database of all data that was in the first 'awaiting table'. What would the code need to be to complete this? I have tried to record the macro but when i do this it selects a definate range ((A2:L4)), therefore i need it to copy all rows with data in them excluding the top row.



Posted by Dave Hawley on April 03, 2001 2:14 PM


Hi Chris

Try this

Sub tryThis()

Sheets("Sheet1").UsedRange.Offset(1, 0).Copy _
Destination:=Sheets("sheet2").Range("A2")

End Sub


....OR if you need to paste at the last row in your destination sheet, you could use this.

Sub tryThis()

Sheets("Sheet1").UsedRange.Offset(1, 0).Copy _
Destination:=Sheets("sheet2").Range("A65536").End(xlUp).Offset(1, 0)

End Sub

Dave


OzGrid Business Applications