I have a table of numbers and formulas for each row, column, and for the table as a whole. The table is part of a report - the output of the application. The user wants to exclude certain numbers from the calculations after reviewing them. These numbers would be outliers and would skew the results. The calculations are AVERAGE and STDEV functions. If a number is excluded, it needs to still be shown on the reports, but with a strikethrough format.
The obvious course is to modify the formula when the user has identified a cell to exclude. With formulas for every row, column, and for the whole table, that's a pretty big job. An easier way is to change the numbers to text. Both AVERAGE and STDEV ignore text, so this would have the effect of excluding the numbers from the formulas without having to change the formulas. I started with something like this:
With Target
If .Font.Strikethrough Then
.Value = CDbl(.Value)
.Font.Strikethrough = False
Else
.Value = "'" & .Value
.Font.Strikethrough = True
End If
End With
This is in the worksheet's BeforeDoubleClick event. I use the strikethrough property to determine if the number has already been excluded. The user can double click the number to toggle between inclusion and exclusion. Excluded numbers have an apostrophe put in front of them (making them text) and the font is changed to strikethrough. Included numbers are changed back to a Double (using CDbl) and the strikethrough is removed.
Incidentally, not every number can be excluded. I've applied a particular style to those numbers that can be excluded and I limit the event like this:
If Target.Style.Name = "TBData2" Then
A new wrinkle appeared. Now some of the numbers are actually formulas. That complicates the above code snippet a little.

With Target
If .HasFormula Then
lStart = 2
Else
lStart = 1
End If
If .Font.Strikethrough Then
.Formula = "=" & Mid(.Formula, Len("=TEXT()"), _
Len(.Formula) - Len("=TEXT()'',") - Len(.NumberFormat))
.Font.Strikethrough = False
Else
.Formula = "=TEXT(" & Mid(.Formula, lStart, Len(.Formula)) & _
",""" & .NumberFormat & """)"
.Font.Strikethrough = True
End If
End With
Instead of putting an apostrophe in front of the value to make it text, I surround it with the TEXT function. This has the added benefit of keeping the same number format applied to the text as was applied to the number. When a number is excluded (the Else part), I start with "=TEXT(". Then I repeat the existing formula, removing the equal sign if there was one (Mid(.Formula, lStart, Len(.Formula))). The suffix to this string manipulation is the existing NumberFormat surrounded by double quotes.
When a number is included, the TEXT portion of the formula is removed. The Mid function starts at Len("=TEXT()"), which is a verbose way of saying 7. The length of Mid is the length of the formula, minus the length the text function (including parentheses, the comma that separates the number format argument, and the quotes that surround the number format), minus the length of the numberformat.
This has the strange side effect of converting a number like 3 into a formula like =3 when it's toggled. I can't think of any ill effects of that, but there may be.