VBA - Paste Values only

wrightyrx7

Well-known Member
Joined
Sep 15, 2011
Messages
994
Hello all, I have this VBA and wanted to know how I can get it to paste the values only because at the minute it changes the format of the cells on the sheets its being pasted to?

Sub Test()

Cells(ActiveCell.Row, 1).Copy Sheets("Advance Payment").Cells(6, 2)
Cells(ActiveCell.Row, 3).Copy Sheets("Advance Payment").Cells(2, 5)
Cells(ActiveCell.Row, 4).Copy Sheets("Advance Payment").Cells(5, 5)
Cells(ActiveCell.Row, 10).Copy Sheets("Advance Payment").Cells(15, 4)
Cells(ActiveCell.Row, 11).Copy Sheets("Advance Payment").Cells(17, 5)
Cells(ActiveCell.Row, 11).Copy Sheets("Advance Payment").Cells(18, 5)
Cells(ActiveCell.Row, 12).Copy Sheets("Advance Payment").Cells(12, 4)
Cells(ActiveCell.Row, 8).Copy Sheets("Advance Payment").Cells(1, 5)

Sheets("Advance Payment").Activate


End Sub

Thanks
Chris
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Is the sheet it is copying from changing (and thus needs to be the activesheet)? Or is it always copying from the same sheet?
 
Upvote 0
ACK!... Nevermind that last. ActiveCell should have been a clue.
 
Upvote 0
This looks a lot like you're other post I've been answering. Try this:

Code:
Sub a()

Dim i As Long

With Sheets("Advance Payment")
    .Cells(6, 2) = Cells(ActiveCell.Row, 1)
    .Cells(2, 5) = Cells(ActiveCell.Row, 3)
    'etc
    'etc
End With


End Sub
 
Upvote 0
Untested - try:
Rich (BB code):
 With ThisWorkbook
Worksheets("Advance Payment").Cells(6, 2).Value = Cells(ActiveCell.Row, 1).Value
Worksheets("Advance Payment").Cells(2, 5).Value = Cells(ActiveCell.Row, 3).Value
Worksheets("Advance Payment").Cells(5, 5).Value = Cells(ActiveCell.Row, 4).Value
 
'...and so on...
End With
 
Upvote 0
Where abouts am i putting this code (im sorry im really new to vba)

Njimack i tried urs like this

Code:
Sub Test()
Sheets("Advance Payment").Cells(8, 1) = Cells(ActiveCell.Row, 6) & " " & Cells(ActiveCell.Row, 7)
Cells(ActiveCell.Row, 1).Copy Sheets("Advance Payment").Cells(6, 2)
Cells(ActiveCell.Row, 3).Copy Sheets("Advance Payment").Cells(2, 5)
Cells(ActiveCell.Row, 4).Copy Sheets("Advance Payment").Cells(5, 5)
Cells(ActiveCell.Row, 10).Copy Sheets("Advance Payment").Cells(15, 4)
Cells(ActiveCell.Row, 11).Copy Sheets("Advance Payment").Cells(17, 5)
Cells(ActiveCell.Row, 11).Copy Sheets("Advance Payment").Cells(18, 5)
Cells(ActiveCell.Row, 12).Copy Sheets("Advance Payment").Cells(12, 4)
Cells(ActiveCell.Row, 8).Copy Sheets("Advance Payment").Cells(1, 5)


Dim i As Long

With Sheets("Advance Payment")

    .Cells(6, 2) = Cells(ActiveCell.Row, 1)
    .Cells(2, 5) = Cells(ActiveCell.Row, 3)
    .Cells(5, 5) = Cells(ActiveCell.Row, 4)
    .Cells(15, 4) = Cells(ActiveCell.Row, 10)
    .Cells(17, 5) = Cells(ActiveCell.Row, 11)
    .Cells(18, 5) = Cells(ActiveCell.Row, 11)
    .Cells(12, 4) = Cells(ActiveCell.Row, 12)
    .Cells(1, 5) = Cells(ActiveCell.Row, 8)
End With
Sheets("Advance Payment").Activate

End Sub

But still overwriting the format on the Advance Payment worksheet


This looks a lot like you're other post I've been answering. Try this:

Yes it is, i didnt want to bother you any more thoguth i would start doing your head in lol


Thanks for the replies guys think i just need a little more guidance please.

Chris
 
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,522
Members
452,923
Latest member
JackiG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top