VBA Copy formulas and paste as values

kanishkgarg

New Member
Joined
Sep 29, 2021
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have got a fairly simple problem. The following is the part of my code i am having problem with:


VBA Code:
s2.Range("d3").Select
ActiveCell.Formula2R1C1 = "=SUMPRODUCT(IF('" & s1.Name & "'!R3C5:R50000C5='" & s2.Name & "'!RC1, '" & s1.Name & "'! R3C20:R50000C20*'" & s1.Name & "'!R3C28:R50000C28))"

s2.Range("d3:d" & Range("A" & Rows.Count).End(xlUp).Row).FillDown
   


s2.Range(Range("B3:D3"), Range("A3").End(xlDown)).Select
Selection.Copy
s2.Range("B3").PasteSpecial xlPasteValues

Data from B3 to D is full of formulas. I would like to copy and paste it as values. When I use this code for some reason, it pastes the values of three cells (B3:D3) throughout the 3 columns. I need it to paste the values as is.

Any help is greatly appreciated!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
where are you trying to paste?? what is in column A
your code above selects all cells from A3 to D(lastrow in a), your then asking it to copy that selection and paste it to b3 which will paste the range and effectively offset the range by 1 column
 
Last edited:
Upvote 0
Maybe...

Rich (BB code):
With s2.Range("B3:D" & s2.Range("A" & Rows.count).End(xlUp).Row)
    .Value = .Value
End With
 
Upvote 0
Solution

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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