ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste values in VB (https://www.excelbanter.com/excel-programming/338871-paste-values-vbulletin.html)

Alex Martins[_2_]

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

Tom Ogilvy

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




Alex Martins[_2_]

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





kraljb[_13_]

Paste values in VB
 

Sheets("NEW").Range("K12:O12").Copy
Sheets("BD1").Range("C5").End(xlDown).Offset(1, 0).PasteSpecial
Paste:=xlPasteValues

Hope that helps


--
kraljb
------------------------------------------------------------------------
kraljb's Profile: http://www.excelforum.com/member.php...fo&userid=9955
View this thread: http://www.excelforum.com/showthread...hreadid=400915


Alex Martins[_2_]

Paste values in VB
 
Hey K...I couldn't make that work...thanks for the help. If you think of
anything else please let me know.

Thanks again for your help!
Alex

"kraljb" wrote:


Sheets("NEW").Range("K12:O12").Copy
Sheets("BD1").Range("C5").End(xlDown).Offset(1, 0).PasteSpecial
Paste:=xlPasteValues

Hope that helps


--
kraljb
------------------------------------------------------------------------
kraljb's Profile: http://www.excelforum.com/member.php...fo&userid=9955
View this thread: http://www.excelforum.com/showthread...hreadid=400915



Patti[_2_]

Paste values in VB
 
Alex,

On sheet BD1, do you have any data in column C in/after row 6? If not, that
would cause the error.

Both of the suggestions worked for me, although I did have to put a line
continuation character (space underscore space) in this one after
PasteSpecial:

Sheets("NEW").Range("K12:O12").Copy
Sheets("BD1").Range("C5").End(xlDown).Offset(1, 0).PasteSpecial _
Paste:=xlPasteValues

Regards,

Patti



"Alex Martins" wrote in message
...
Hey K...I couldn't make that work...thanks for the help. If you think of
anything else please let me know.

Thanks again for your help!
Alex

"kraljb" wrote:


Sheets("NEW").Range("K12:O12").Copy
Sheets("BD1").Range("C5").End(xlDown).Offset(1, 0).PasteSpecial
Paste:=xlPasteValues

Hope that helps


--
kraljb
------------------------------------------------------------------------
kraljb's Profile:
http://www.excelforum.com/member.php...fo&userid=9955
View this thread:
http://www.excelforum.com/showthread...hreadid=400915





Tom Ogilvy

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








All times are GMT +1. The time now is 10:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com