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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Looks like the name of the sub is missing! Try
Sub MySub() 'or something like it!
then include the rest of what you posted!
 
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
 
Back
Top