Macro code for pasting the cell.

bubbles2010

New Member
Joined
Jun 15, 2010
Messages
19
Hello. I am a new user. I was trying to copy the sum from sheet1 to sheet2 in the same work book with macro. I was using this code:
Range(Sheets(1).Rows(36), Sheets(1).Rows(36)).Copy Destination:=Sheets(2).Range("A36")

It works fine. The only problem is it is copying the formula, but not the actual value. I know how to reference using excel equation, but I don't want to do that. I want to use VB code.
Thank you so much.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I'm sure that there are more ways to do it, but here are two:
Code:
Sub firstoption()
    With Sheets(2).Rows(36)
        .Value = Sheets(1).Rows(36).Value
    End With
End Sub
Code:
Sub secondoption()
    Sheets(1).Rows(36).Copy
    Sheets(2).Rows(36).PasteSpecial Paste:=xlValues
End Sub
 
Upvote 0
I wouldn't use the With for only 1 line of code:

Code:
Sub test()
Sheets(2).Rows(36).Value = Sheets(1).Rows(36).Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,165
Messages
6,129,235
Members
449,496
Latest member
Patupaiarehe

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