Format cell color based on formula

Tkeller

Board Regular
Joined
Jul 23, 2003
Messages
143
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I am looking for a way in VBA to do the following:

Go through the current worksheet and if the formula references a cell, ON THE SAME WORKSHEET, that is after the current row (i.e. at least one row below), then that cell should be shaded grey. So, for example, if I have the formula on sheet1! in cell C10: = B11+4, then this cell should be shaded grey (as it referes to a cell on the same worksheet below the current row). If I have the formula in cell C10: = Sheet2!B11+4, then there should be no change to the cell(as it refers to a cell on aother worksheet. If I have the formula in cel C10: =X10 +4, then nothing should change (as it refers to a cell on the same row).

There should be a way to do this easily in VBA.

Thanks so much.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,224,521
Messages
6,179,282
Members
452,902
Latest member
Knuddeluff

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