Highlight cell where formula is overwritten

samsnee

Board Regular
Joined
Dec 16, 2005
Messages
73
Hi

I am trying to write a code where if someone keys over a formula in a cell so it is now value, the cell is highlighted. This includes if the cell also is linked to any additional files. Any ideas?

Thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Conditional Formatting: =isformula()

1. That function is only available in later versions of excel, OP may not have a later version.
2. That will highlight all cells in the "applies to" range, that contain a formula. I think OP wants to ID cells that had formulas that were overwritten - in which case, they will need VBA
 
Upvote 0
How does isformula work? I tried putting it in as rule for conditional formatting but nothing happens.

I'm basically trying to highlight whenever someone hardkeys over a formula.

Thanks
 
Upvote 0
Spreadsheet Formulas
CellFormula
C1=5+5
D1=NOT(ISFORMULA(C1))

<tbody>
</tbody>

<tbody>
</tbody>

The formula from D1 can you place by a Conditional Format (new rule; apply to C1)

Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG23Aug22
Private [COLOR="Navy"]Sub[/COLOR] Worksheet_Change(ByVal Target [COLOR="Navy"]As[/COLOR] Range)
[COLOR="Navy"]Dim[/COLOR] oVal [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
[COLOR="Navy"]If[/COLOR] Target.Count = 1 [COLOR="Navy"]Then[/COLOR]
    oVal = Target.Formula
    [COLOR="Navy"]With[/COLOR] Application
        .EnableEvents = False
            .Undo
            [COLOR="Navy"]If[/COLOR] Target.HasFormula [COLOR="Navy"]Then[/COLOR] Target.Interior.Color = vbYellow
            Target = oVal
        .EnableEvents = True
    [COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
The code above was incorrectly pasted, Try this:-
Code:
Private [COLOR="Navy"]Sub[/COLOR] Worksheet_Change(ByVal Target [COLOR="Navy"]As[/COLOR] Range)
[COLOR="Navy"]Dim[/COLOR] oVal [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]String[/COLOR]
[COLOR="Navy"]If[/COLOR] Target.Count = 1 [COLOR="Navy"]Then[/COLOR]
    oVal = Target.Formula
    [COLOR="Navy"]With[/COLOR] Application
        .EnableEvents = False
            .Undo
            [COLOR="Navy"]If[/COLOR] Target.HasFormula [COLOR="Navy"]Then[/COLOR] Target.Interior.Color = vbYellow
            Target = oVal
        .EnableEvents = True
    [COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]If[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,946
Members
449,134
Latest member
NickWBA

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