I have data to enter into cells that is the result of some basic addition. Rather than screwing up the addition in my head, I'd like to just type the addition into a cell, but without keeping the formula.
So, is there a way to type 9+9 into a cell, and have the cell's contents be "18" and NOT "9+9," NOR "=sum(9+9)?"
You could use vba. Using a Worksheet_Change event like this:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo cleanup
Application.EnableEvents = False
If Not Intersect(Range("A:A"), Target) Is Nothing Then
Target.Value = Me.Evaluate(Target.Value)
End If
Application.EnableEvents = True
Exit Sub
cleanup:
Application.EnableEvents = True
End Sub
Put this in the worksheet code of the worksheet you want. Change the Intersect Range("A:A") to that of the cells in which you want it to fire.
As is, If I type 9+9
in A1 it replaces it with 18
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments