Thursday, 5 March 2015

How to Convert Numbers Stored in Text Format to Numbers

Macro to Convert  Text Format Numbers to Number Format
Sub Convert_Number2Text2Number()
'Converts the Number Stored in Text Format to Number Format

For Each xCell In Selection

xCell.Value = CDec(xCell.Value)

Next xCell

'To Convert the Number Format as to Show Negative Numbers in (Closed Backets) with Red Color

Selection.NumberFormat = "0_);[Red](0)"

Eg :

-123 = (123)

'To Convert the Number to Text Format

'First convert the Data format to Text format Selection.NumberFormat = "@"

'Next convert each cell format to Text format

For Each xCell In Selection

xCell.Value = CStr(xCell.Value)


Next xCell

End Sub

No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts