Thread: Macro Paste
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Macro Paste

that is because your code is looking for a separate function named lastrow.
If you don't supply one, then you can just use

Sub copy_1_Values_PasteSpecial()
Dim sourceRange As Range
Dim destrange As Range
Dim Lr As Long
Application.ScreenUpdating = False
Lr = Sheets("Log").Cells(rows.count,"C").End(xlup).row + 1
Set sourceRange = Sheets("Temp").Range("C7:W12")
Set destrange = Sheets("Log").Range("C" & Lr)
sourceRange.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy


"Tom" wrote in message
oups.com...
Below is what I tried to run but I get a compile error: Sub or
Function not defined at line 6 Lr =

Sub copy_1_Values_PasteSpecial()
Dim sourceRange As Range
Dim destrange As Range
Dim Lr As Long
Application.ScreenUpdating = False
Lr = LastRow(Sheets("Log")) + 1
Set sourceRange = Sheets("Temp").Range("C7:W12")
Set destrange = Sheets("Log").Range("C" & Lr)
sourceRange.Copy
destrange.PasteSpecial xlPasteValues, , False, False
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

On Jan 27, 8:15 pm, JLatham <HelpFrom @ Jlathamsite.com.(removethis)
wrote:
Also, see Chip Pearson's response to this question which is pretty much
the
same one you've just
asked:http://www.microsoft.com/office/comm....mspx?dg=micro...



"Tom" wrote:
Writing a macro and trying to copy several cells from sheet 1 and then
paste into sheet 2 while not pasting over existing data. Is there a
way to auto select the next blank cell in the column in sheet 2 and
paste. Say if A1 is not blank, then auto select A2 instead and so on.


I'm using sheet 1 as the data entry sheet and then sheet 2 to collect
the data for creating charts, etc. Don't want to paste over existing
data.


Tom- Hide quoted text -- Show quoted text -