Replace formula content after specific character in workbook

Olivv

New Member
Joined
Dec 25, 2017
Messages
6
I have formulas in multiple worksheets that start with "=GetCtData".

They usually look like these:
=GetCtData(G$1:G$10;$C15:$D15;"#70.123")
=GetCtData(G$3:G$12;$C13:$D17;"#123.456")

I would like the content after the hashtag to be replaced by 0 in all worksheets, so the formulas end up like those:
=GetCtData(G$1:G$10;$C15:$D15;"#0")
=GetCtData(G$3:G$12;$C13:$D17;"#0")

I have not been able to make it work so far. I tried with the Developer mode to record a "Ctrl + H"
1690972019456.png


Here is the non working code recorded with the Developer mode (for replacing in the ActiveSheet), that does not work when I run the macro:
VBA Code:
Sub Macro3()
    Cells.Replace What:=";""#*", Replacement:=";""0"")", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
End Sub

And ChatGPT is useless on this matter.

Any ideas about how to make it work?
 

Attachments

  • 1690971889678.png
    1690971889678.png
    17.4 KB · Views: 4

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Shouldn't your find and replace be more along these lines?
1690973560847.png
 
Upvote 0

Forum statistics

Threads
1,215,092
Messages
6,123,063
Members
449,090
Latest member
fragment

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