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 Paste values in VB

You would have that problem if there were all empty cells from C6 to the
last cell in that column.

You would have the same problem with your original code.


Sub UpdateBD1()
dim rng as Range
set rng = sheets("BD1").range("C5")
if not isempty(rng) then
if isempty(rng.offset(1,0) then
set rng = rng.offset(1,0)
else
set rng = rng.end(xldown)(2)
end if
Sheets("NEW").Range("K12:O12").Copy
rng.PasteSpecial xlValues
End Sub

--
Regards,
Tom Ogilvy


"Alex Martins" wrote in message
...
Hey Tom, thanks for all your help!

This is giving me an error though...I copied what you sent and it says
"application-defined or Object_defined error".

Do you know what I might be doing wrong?

Thanks again man.
Alex


"Tom Ogilvy" wrote:

Sub UpdateBD1()
Sheets("NEW").Range("K12:O12").Copy
Sheets("BD1").Range("C5").End(xlDown) _
.Offset(1, 0).PasteSpecial xlValues
End Sub

--
Regards,
Tom Ogilvy

"Alex Martins" wrote in message
...
Hi I need some help with the pastevalues for this, which isn't pasting
values...:
Sub UpdateBD1()
Sheets("NEW").Range("K12:O12").Copy Destination:= _
Sheets("BD1").Range("C5").End(xlDown) _
.Offset(1, 0)
End Sub

I thank you in advance for your help.

Alex