View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
J_Knowles[_2_] J_Knowles[_2_] is offline
external usenet poster
 
Posts: 25
Default Number Stored As Text

Here are two macros:
A) convert text numbers to numbers
B) numbers to text numbers

You were interested in the TextToNumbers macro.

Sub TextToNumbers()
' Converting text numbers to real numbers
' Using the the used range for selection of cells
'
Dim cellval As Range
Dim myRng As Range
Set myRng = ActiveSheet.UsedRange
For Each cellval In myRng
cellval = cellval.Value
Next
End Sub

Sub NumbersToText()
' Converting numbers to text numbers
' Using the the used range for selection of cells
'
Dim cellval As Range
Dim myRng As Range
Set myRng = ActiveSheet.UsedRange
For Each cellval In myRng
If WorksheetFunction.IsNumber(cellval.Value) Then
cellval = "'" & cellval.Value
End If
Next
End Sub

HTH
--
Data Hog


"Paul W Smith" wrote:

What property of a cell should I check to determine whether that cell
contains a number stored as text?

I have some cells which Excel 2007 tells me, via the office assistant, are
numbers stored as text. I want to loop through all the cells in the used
range testing for and correcting this.

Paul Smith


.