Conditional Formatting: =isformula()
Spreadsheet Formulas | ||||||
<tbody> </tbody> |
[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]
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]