Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy & Paste

Status
Not open for further replies.

max1565

Technical User
Dec 16, 2002
57
0
0
US
I have the folowing code , but it is not working. Can someone tell me what is wrong?


Dim LastRow As Integer
LastRow = Sheets("database").Range("A5").End(xlDown).Row
Sheets("database").Range("a1:AG1").Copy Destination:= _
Sheets("database").Range("A" & LastRow + 1)

Thanks
 
Hi max1565

The syntax seems to be ok. The only problem I can see is the declaration of 'LastRow' as data type Integer. If the last row is > 32'767 you'll get an overflow error. Variables for rows are usually declared as Long.

Philipp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top