formula dependant and independant value

sujittalukde

Well-known Member
Joined
Jun 2, 2007
Messages
520
Can a macro be provided to change the color of values in a cell of a sheet for the following:

1. The figures or values which are a result of formula in a sheet to color say red

2. the values which are consonant but used for formula in any sheet in a workbook to color say ble

3. The values which are neither a result of formula nor used for formula to stay black
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
I assume that the purpose of this is to identify the 3 different types of cell as you have defined. In which case, you could always use Edit>GoTo>Special and then select either Precidents, Dependants, or Constants as desired.
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Code:
Sub test()
For Each Cell In Range("a1:G10")
    Cell.Font.ColorIndex = -4105
    x = ""
    On Error Resume Next
    x = Cell.Dependents.Address
    If x <> "" And Cell.HasFormula = False Then
        Cell.Font.ColorIndex = 5
    End If
    If Cell.HasFormula = True Then
        Cell.Font.ColorIndex = 3
    End If
Next Cell

End Sub
 

Forum statistics

Threads
1,181,372
Messages
5,929,565
Members
436,679
Latest member
helly123

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
Top