Forum Discussion
Save Previous Cell Value Of A Changed Cell In Excel
Here are two possible solutions that you could use in brief. The first is for the current cell. Even if several cells are selected, only the current cell is converted:
Sub RngFormelZuWert ()
Dim c As Range
For Each c In Selection
c.Value = c.Value
Next c
End Sub
Yes, you can also do without the word Value, because in this case it is the default property. But better safe than sorry, and this is how it will work 10 years from now.
The second possibility would be that all cells in a marked area should be "treated" in this way. Then this code leads to the goal:
Sub RngFormelZuWert ()
Dim c As Range
For Each c In Selection
c.Value = c.Value
Next c
End Sub
You can see that this is hardly more code than in the first example.
Is for everyone who would like to have it short and sweet:
Sub Sel2Val ()
Selection.Value = Selection.Value
End Sub
I hope that I was able to help you further, or to provide a solution.
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.
Thank you for the reply! I do not know how to write vba code at all so all I do is copy and paste what is given to me. I have done so with the code you provided and nothing happened. I am trying to have column D record the previous value (NOT formula) of Column G. could you tell me what to change to your code written to do so? again thank you so so much for the help! I greatly appreciate it