Help: need a macro to paste values conditional on formula being sumproduct

msantas

New Member
Joined
Aug 22, 2013
Messages
6
I have a workheet which I use "sumproduct" formulas to pull in new data every week. Within the worksheet there are also "sum" formulas that gives subtotals in certain sections. I want to create a macro that pastes values over the sumproduct formulas without pasting values over the sum formulas. However I don't want to have to specify a specific range within the worksheet to paste values because these ranges will change.

So basically I need a script that can paste values conditional on the formula being a sumproduct. Is this possible? Thanks!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I found a script that does almost exactly what I need. However this script pastes values over all Sumproduct formulas in the entire worksheet. I need it to specify a particular column. How can I make that adjustment?

Sub RemoveSumproductFormulas()
Dim rng As Range
With Worksheets("Centers")
For Each rng In .UsedRange
If rng.Formula Like "*SUMPRODUCT*" Then rng.Formula = rng.Value
Next rng
End With
End Sub
 
Upvote 0
More specifically I need to specify it only paste values in the column of the current active cell.

I found a script that does almost exactly what I need. However this script pastes values over all Sumproduct formulas in the entire worksheet. I need it to specify a particular column. How can I make that adjustment?

Sub RemoveSumproductFormulas()
Dim rng As Range
With Worksheets("Centers")
For Each rng In .UsedRange
If rng.Formula Like "*SUMPRODUCT*" Then rng.Formula = rng.Value
Next rng
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,506
Messages
6,125,197
Members
449,214
Latest member
mr_ordinaryboy

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