View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Faboboren Faboboren is offline
external usenet poster
 
Posts: 39
Default convert a range of text into numbers

Gary,

But how can I include in this macro a selection for variably sized range
Because this is part of a bigger macro, I do not want select the range
manually

Thanks



"Gary''s Student" wrote:

Just select them in the worksheet before running the macro. You can select a
row or a column or a pile of cells.
--
Gary''s Student - gsnu200754


"Faboboren" wrote:

Gary,

it is working for 1 cell, but how do I select the whole range of
text-numbers to convert in numbers

"Gary''s Student" wrote:

Sub numerify()
Dim r As Range
Count = 0
For Each r In Selection
If Application.IsText(r.Value) Then
If IsNumeric(r.Value) Then
r.Value = 1# * r.Value
r.NumberFormat = "General"
Count = Count + 1
End If
End If
Next
MsgBox (Count & " cells changed")
End Sub

--
Gary''s Student - gsnu200754


"Faboboren" wrote:

Hi

I have a variably sized range with numbers in text format.
I want to select them, and convert to numbers.

Thanks