Copy information to the last row of another sheet in excel 2003

G

Guest

I'm trying to copy information to another sheet "Data" to the last row of it.
I tried the macro fro Ron Debruin but is giving me an error "Invalid outside
procedure", can somebody help me, thanks

Dim sourceRange As Range
Dim destrange As Range
Dim Lr As Long
Lr = LastRow(Sheets("Data")) + 1
Set sourceRange = Sheets("Control").Range("A6:L26")
Set destrange = Sheets("Data").Range("A" & Lr)
sourceRange.Copy destrange
End Sub
 
B

Bob Umlas

Looks like the name of the sub is missing! Try
Sub MySub() 'or something like it!
then include the rest of what you posted!
 
G

Guest

Thanks Bob, I found that with the modification as follow it works, thanks again
Dim sourceRange As Range
Dim destrange As Range
Dim Lr As Long
Application.ScreenUpdating = False
Lr = Sheets("Data").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row + 1
Set sourceRange = Sheets("Control").Range("A6:l26")
Set destrange = Sheets("Data").Range("A" & Lr)
sourceRange.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
Application.ScreenUpdating = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top