VBA - Find and Replace Using Cell Reference on separate tab

MrSourApple

New Member
Joined
Oct 23, 2015
Messages
17
I am trying to find and replace part of a formula using vba by referencing the value of a cell.

What I need to do:
Find - Value of cell E10 on tab name "Admin"" within the formula in cell E8 of the "Submission Comparison" tab
Replace - the string within the formula with value of cell E9


Specifics:
Cell E10 on the tab "Admin" contains "_17Official" (this cell runs on a formula and is updated regularly)
Cell E9 on the tab "Admin" contains "_17Passback" (also updated regularly)

Cell E8 on the tab "Submission Comparison" has the formula:

=IF(Admin!$E$6="Formulation",IFERROR(SUMIFS(PY_17Official,UII_17Official,$A16........)

I would like to use vba to replace the "_17Official" with "_17Passback", however, I need to to be based on the tab/cell reference so it can be updated regularly.

Thank you!!!
 
Assuming you always want to use the value of Admin!E9 (?) you could do something like this:

Code:
s = Sheets("Admin").Range("E9").Value
Sheets("Submission Comparison").Range("E8").Formula = _
    "=IF(Admin!$E$6=""Formulation"",IFERROR(SUMIFS(PY" & s & ",UII" & s & ",$A16........"
 
Upvote 0

Forum statistics

Threads
1,226,849
Messages
6,193,331
Members
453,790
Latest member
yassinosnoo1

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