• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Convert Active CellS from function into value

akuku

New Member
Hi!

I have this little macro as below:
Code:
Sub CopyValue()
    ActiveCell.Value = ActiveCell.Value
    ActiveCell.NumberFormat = ActiveCell.NumberFormat
End Sub

It works for only one active cell. What if I want to select mutliple cells (e.g. A1, A13, A34, A130) and use a macro which converts functions already calculated in those cells into values?

Thanks for help!
 
This would do.
Code:
Sub CopyToValues()
Dim c As Range
Application.ScreenUpdating = False
For Each c In Selection
    c.Formula = c.Value
Next c
Application.ScreenUpdating = True
End Sub
 
Thank you! That's very helpful. You have just decreased my time spending on doing that exercise by 25% ;)
 
Last edited:
Hi ,

You can decrease your time a little more by using the bracket convention ; change the following statement :

c.Formula = c.Value

to :

[c] = [c]

Narayan
 
Back
Top