macro to turn "=AQ1180" to =IF(AQ1180="","",AQ1180)

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi everyone,
it seams like so much of my day is spent correcting simple formulas,
to save time what i'd like is a macro that when run

take the selected range, and converts all cells that are just "=another cell"
to =IF(AQ1180="","",AQ1180)
now the cells might ref another sheet as well so it woould be helpfull to take that into account.
='Raw Data Paste'!A66

So if I was writing it in english it would read like this,
for each cell in selected range,
if the cell is
"=AQ1180"
then make it
=IF(AQ1180="","",AQ1180)
please help if you can
Thanks
Tony
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Has selection range same formula instruction (relative formula) : =if (cell="","" cell) ?
If so, this code change all cells those has formula:
VBA Code:
dim cell as range
For each cell in selection
    if cell.hasformula then
          cell.formula = "=IF(AQ1180="","",AQ1180)"
    end if
Next
If it does not work, try to attach a image/screenshot to give us a visual help.
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,597
Members
449,038
Latest member
Arbind kumar

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