MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Converting a "Stringed" Number to a Number

  Asked By: Can    Date: Jan 11    Category: MS Office    Views: 1312

How can I convert a "Stringed" number to a number eg. strNumber
= "234". How do I now get vNumber to equal the number value of
strNumber ie 234. ?



3 Answers Found

Answer #1    Answered By: Brandi Ramirez     Answered On: Jan 11

There are two methods.

1) You could highlight the row in question, and click on the
exclamation mark of the first numbered cell. Assuming you have Office
20003. A list of options will appear allowing you to convert  numbers
stored as text to number.

2) The other is to write a loop statement

The following example will start at the selected cell on the

Dim lRange As Long

Dim l As Long

Dim iNum As Integer

lRange = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row

For l = 1 To lRange

iNum = Val(ActiveCell.Value)

ActiveCell.Value = iNum

ActiveCell.Offset(1, 0).Select


Answer #2    Answered By: Archie Parker     Answered On: Jan 11


vNumber = Val(strNumber)


vNumber = CInt(strNumber)

Val() and CInt() have slightly different functionality for unusual

For example, CInt(“234a”) returns an error, while Val(“234a”) returns 234.
It’s up to you which one is more appropriate in your application.

There’s also CLng() to convert  to a Long (and CBool() to convert to Boolean,
CSng() to convert to Single, CDbl() to convert to Double, CStr() to convert
to String, CDate() to convert to Date, etc.).

Answer #3    Answered By: Hamdan Younis     Answered On: Jan 11

Depends where it is. If it is on the spreadsheet I usually put the value 1 in
a cell, copy it, and then Paste Special (values multiply).

In other word if you multiply "1234" by 1 you get 1234.

Didn't find what you were looking for? Find more on Converting a "Stringed" Number to a Number Or get search suggestion and latest updates.