Possibly you have spaces in your data, or your data contains
non-breaking spaces in html that is and in VBA
it would be CHR(160).
TrimALL macro on my Rearranging Data in Columns page
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
--
HTH,
David McRitchie, Microsoft MVP -- Excel
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
"Cleber Inacio" wrote in message ...
Gary,
thanks for you help...your routine rocks!
actually i was trying something similar, except for the IsNumeric function,
I couldn't find it on my help searches, so i got stuck on the detecting
potential
numbers.
I ran your version but it didint fix numbers, i also had tried PasteSpecial
method
and i got no success, even if doing that manually it worked but no way by
code.
But these are things that i dont even want to understand...now it works and
its
enough for me.
Thanks Again for the help Gary!! and keep helping ppl
Cleber
**Final Code:
Sub KillerNumerify()
Dim double_meu As Double
Dim r As Range
Count = 0
Application.ScreenUpdating = False
For Each w In Worksheets
w.Activate
'In Brazil we use comma instead of dot
Cells.Select
Selection.Replace What:=".", Replacement:=",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
For Each r In ActiveSheet.UsedRange
If Application.IsText(r.Value) Then
If IsNumeric(r.Value) Then
double_meu = CDbl(r.Value)
r.Clear ' my string cells are very powerful...need to kill them
before fixing :)
r.Value = double_meu
Count = Count + 1
End If
End If
Next
Next
MsgBox (Count & " cells changed")
Application.ScreenUpdating = True
End Sub
"Gary''s Student" wrote:
Here is our approach:
1. scan thru each cell in each worksheet
2. find cell that are formatted as Text, but which actually contain numbers
3. fix the cell
Sub numerify()
Dim r As Range
Count = 0
For Each w In Worksheets
w.Activate
For Each r In ActiveSheet.UsedRange
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
Next
MsgBox (Count & " cells changed")
End Sub
Macros are very easy to install and use:
1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window
If you save the workbook, the macro will be saved with it.
To remove the macro:
1. bring up the VBE window as above
2. clear the code out
3. close the VBE window
To use the macro from Excel:
1. ALT-F8
2. Select the macro
3. Touch RUN
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
--
Gary''s Student - gsnu200757
"Cleber Inacio" wrote:
Hi everybody,
I'm facing a simple , but annoying problem...which is driving me crazy...
154000 lines of information where extracted from a corporative database by a
third party for me. These lines
are in 16 .xls, distributed in 640 Sheets. The export process almost workly
perfectly, except for the fact that it showed up the classical 'Convert text
to number' problem. I tried some tricks to automate the corretion of this
problem, to try to turn everything in number, but no sucess.
It seems the only way is to to do manually that multiply by one excel hint...
But it is a lot of handwork to do that in all thesse sheets and files....
The Sheets have some columns with number and other with text...
SOmeone have any idea?
(I already now how to cycle automatically betwen all files and sheets...just
need the piece of code to solve the number issue)
Thanks in advance,
Cleber