Bulk Change existing formulas on sheet

oblix

Board Regular
Joined
Mar 29, 2017
Messages
183
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
  9. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
I have a sheet that has formulas linking to other sheet cells
example of one cell: ='Sheet 1'!G18
would like to change all formulas on a specified sheet to a text formula like example below:
=TEXT('Sheet 1'!G18,"$0.00")
there are just to many to change every single formula to a text formula

is this possible with vba code?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
would a find a replace work - i have used a few times to change formulas
only issue is if 'sheet1'!G18 appears where you do not want to change

find: 'Sheet 1'!G18
Replace: TEXT('Sheet 1'!G18,"$0.00")
 
Upvote 0
I tried but maybe I did it wrong
can you give me example from above examples
 
Upvote 0
Thank you undestand that, but each cell has a different formula(link to other cells).
Thats the part I dont understand how to replace where each cell content is different
 
Upvote 0
can you give examples of the different cells
you originally said
example of one cell: ='Sheet 1'!G18
would like to change all formulas on a specified sheet to a text formula like example below:
=TEXT('Sheet 1'!G18,"$0.00")
so more examples would help here , as i had assumed the G18 was consistant
If it could be any formula with any text in, then i dont know how to change that - - so maybe a VBA solution is your only choice - not my area sorry
 
Upvote 0
The only thing that will be the same in all cells will be the = of the formula, as each formula referes to different sheet and different cells
cant a place holder be given for existing text to be used in the find ?
 
Upvote 0
did it all manually
Issue resolved
 
Upvote 0
Solving it manually is one way. However, to make it less painful, here is the VBA code to do that.
Note: Requires selecting the cells since there is no specific pattern in formulas.

VBA Code:
Sub changeFunctions()
Dim rng As Range
Dim cll As Range
    Set rng = Selection
    
    For Each cll In rng.Cells
        If cll.HasFormula Then 'just in case if there are value cells in the selection
            cll.Formula = "=TEXT(" & Right(cll.Formula, Len(cll.Formula) - 1) & ", ""$0.00"")"
        End If
    Next cll
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,918
Messages
6,122,255
Members
449,075
Latest member
staticfluids

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