Excel Macro Find / Alter / Replace Function

DarthDiggler

New Member
Joined
Nov 4, 2021
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
I have a spreadsheet that already has some macros that setup SUBTOTAL functions where I would like there to be SUM functions.

The code that creats the SUBTOTAL functions I believe is this...

Excel Formula:
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(22), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True

There is one caveat, I would like to change the first Cell cited in the formula down by 1 cell.

I would like: =SUBTOTAL(9,V2:V55)

To turn into: =SUM(V3:V55)

Thanks in advance, I have found solutions for a simple find and replace, but not exactly sure how I move the cell range down 1 cell just for the first cell cited in the function.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Oh to be clear that example was a static one, I would need to be able to do this dynamically to work with any range. It will always be in the same column if that helps.
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,796
Members
449,095
Latest member
m_smith_solihull

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