How To access the convert to numbers funtion in VBA

counterindigo

New Member
Joined
Sep 6, 2011
Messages
4
In excel when a number is stored as text, excel has a function to convert it to numbers that is accessed by the error checking function. I tried to use the macro recorder to discover how to call it, but this didn't work. Any ideas how to access this method via VBA?

Thank you,

Michael
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Welcome to the board.

Code:
    With Range("A1")
        If IsNumeric(.Value2) And VarType(.Value2) = vbString Then
            ' it's a number stored as text
        End If
    End With
 
Upvote 0
Thanks for the reply.

I probably wasn't clear enough with my question. When text is stored as a number on a spreadsheet, it puts a little green triangle in the upper left corner of the cell. If you click on that cell it brings up a little menu. One of the options it "Convert to Number". I know how to write code to convert strings to numbers, but what I'd like to know is how to access the method that excel uses to do the conversion.

Thanks,

Michael
 
Upvote 0
I don't believe it's exposed; it's a UI thing, and easy to do in code without using a method.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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