Macro to convert formula to value - Excel for Mac 2011

Frank Horatio

New Member
Joined
Nov 23, 2010
Messages
14
Hi. New to Macros... Using Excel for Mac 2011.

My goal is to be able to select cells and convert cells with formulas into the resulting values. I manually recorded this Macro:

Code:
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Option+Cmd+q
'
    Range("D16").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Application.CutCopyMode = False
End Sub

And it works nicely. However, I want to be able to perform this task for many cells. I found this macro, but I am getting a syntax error and don't know how to fix it:

Code:
Sub ValuesOnly( )

Dim rRange As Range

    On Error Resume Next

        Set rRange = Application.InputBox(Prompt:="Select the formulas", _

                                  Title:="VALUES ONLY", Type:=8)

        If rRange Is Nothing Then Exit Sub

    rRange = rRange.Value

End Sub</pre>

Thanks!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
The blank line is causing the error:
Code:
Sub ValuesOnly()
    Dim rRange      As Range
 
    On Error Resume Next
    Set rRange = Application.InputBox(Prompt:="Select the formulas", _
                                      Title:="VALUES ONLY", Type:=8)
    If rRange Is Nothing Then Exit Sub
 
    rRange.Value = rRange.Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,466
Messages
6,124,983
Members
449,201
Latest member
Lunzwe73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top