View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre Ron Coderre is offline
external usenet poster
 
Posts: 2,118
Default Convert text to number

Are you saying that the same Cognos-to-Excel report displayed the field as
text pre-SP2, but displays numbers now?
Example:
Was: 0032
Now: 32

OR...are you importing a Cognos gererated text file and that's the new
behavior?

***********
Regards,
Ron

XL2002, WinXP


"Erinayn" wrote:

Anyone have an answer about the other way.
We run a report from a Cognos report writing and it dumps to excel. We
recently had the Office SP2 installed and now some of our test data fields
are showing a numbers only. We've tried everything to get them to change to
text. Paste special, formatting, format paintbrush, adding apostrophe,
removing the date - all kinds of different things.
Does anyone have an idea of a solution or a cause?

"Gary''s Student" wrote:

Ron's solution is best, but if you really need a macro then:

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

Converts both text cells and apostrophe'd values.
--
Gary's Student


"Donna S" wrote:

I have a column of numbers but some is stored as text and some as numbers. I
would like to convert all of them to numbers in a macro but don't know how.
I've tried recoreding a macro when selecting the list and clicking on the
convert to number but the macro doesn't seam to record that part. Help please.

Donna