Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
How can I use the formula function in conditional formatting in order to
indicate if a formula in the cell has been altered? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi,
Conditional formatting alone can not do this for you. You would need an change event macro. Assuming G1 is the cell you want to check, and =G2+G3 is the formula you want unchanged in G1, try something like: Private Sub Worksheet_Change(ByVal Target As Range) If Range("G1").Formula < "=G2+G3" Then MsgBox "Formula in G1 is incorrect" End Sub Change references and the desired formula to suit your sheet. You could put anything you like after 'Then' I've put in a message box. Regards - Dave. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
thank you. I want to allow the cells to be changed but want to be able to
see if someone changed them. Specifically, I'm forcasting results based on trends but, want salepeople to be able to change the forecasted trends if necessary. If they make a change in a cell with the forecasted formula, I want to quickly be able to see what cells they changed (or hardcoded in their number). I think that your macro would work at limiting a user from making a change in the formula but, I actually want them to make changes in the formula'd cells but see where they made changes quickly. Is there a possible solution for this request? Thanks. Adam "Dave" wrote: Hi, Conditional formatting alone can not do this for you. You would need an change event macro. Assuming G1 is the cell you want to check, and =G2+G3 is the formula you want unchanged in G1, try something like: Private Sub Worksheet_Change(ByVal Target As Range) If Range("G1").Formula < "=G2+G3" Then MsgBox "Formula in G1 is incorrect" End Sub Change references and the desired formula to suit your sheet. You could put anything you like after 'Then' I've put in a message box. Regards - Dave. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
OK, what about:
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(ActiveCell, Range("G1")) Is Nothing Then Range("G1").Font.ColorIndex = 3 Range("G1").Font.Bold = True End If End Sub This will allow a change in G1, but apply red bold when it is. Any good? Regards - Dave. |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
WOW, that is good. only 2 more quick questions: (1) how do I do that for a
range of cells? and (2) how do I do it so that it only highlights in red font if the formula is replaced by a hard coded number? (I have a drop down reference that allows the forecast formula results to change but I don't want that to affect the font, I only want a hard coded input to affect the font). Thanks! Adam "Dave" wrote: OK, what about: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(ActiveCell, Range("G1")) Is Nothing Then Range("G1").Font.ColorIndex = 3 Range("G1").Font.Bold = True End If End Sub This will allow a change in G1, but apply red bold when it is. Any good? Regards - Dave. |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi,
Second question first: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(ActiveCell, Range("G1")) Is Nothing Then If Not Range("G1").HasFormula Then Range("G1").Font.ColorIndex = 3 Range("G1").Font.Bold = True End If End If End Sub First question: what range do you want? How many cells in your range? Regards - Dave. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formatting cells in a column with conditional formatting? | Excel Discussion (Misc queries) | |||
Protect Cell Formatting including Conditional Formatting | Excel Discussion (Misc queries) | |||
conditional Formatting based on cell formatting | Excel Worksheet Functions | |||
conditional Formatting based on cell formatting | Excel Worksheet Functions | |||
Conditional Formatting that will display conditional data | Excel Worksheet Functions |