View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
p45cal[_263_] p45cal[_263_] is offline
external usenet poster
 
Posts: 1
Default Excel Convert text to Number


so after:

VBA Code:
--------------------


oRange.Value = TheArray
--------------------



just have:

VBA Code:
--------------------


Orange.Value = Orange.Value
--------------------



you could also temporarily put the line:

VBA Code:
--------------------


Orange.numberformat = "General"
--------------------


before the -orange.value = orange.value- line but I'd expect you
wouldn't need that after the first run, especially if there are special
formats you want to keep in that range?

Anyway, try it and see, fingers crossed. At least it should be quick.

Afterthought: you don't have to do this for the whole range, you could
do it for just a few columns:

VBA Code:
--------------------


Orange.columns(2).value = Orange.columns(2).value
--------------------


or for mo

VBA Code:
--------------------


Set rngToMakeNos = Union(orange.Columns(3), orange.Columns(5), orange.Columns(7))
rngToMakeNos.Value = rngToMakeNos.Value
--------------------







JoeBoynton;705723 Wrote:

I'll try your suggestion later, couldnt just now
btw i converted the cells from text to number 1 by 1 as follows:

Dim oRange = oWs.Range("A1").Resize(reszRow, rs.Fields.Count)
oRange.Value = TheArray

' rs is from legacy Acucobol vision files read with odbc/dao off of
Linux server

For myOrRow = 1 To ArrayRowCount + 1

' Extra row count above because I loaded headers into row 1

For myOrColumn = 1 To rs.Fields.Count
If IsNumeric(oRange(myOrRow, myOrColumn).Value) Then
oRange(myOrRow, myOrColumn).Value = oRange(myOrRow,
myOrColumn).Value.ToString * 1
End If
Next
Next

This seems to fix the problem, but its a time killer cause it's cell by

cell[color=blue]

Thx for suggestions

"p45cal" wrote:


How are you getting the numbers-stored-as text into cells to test?
I'll do the same and test again..




Peter T;705601 Wrote:

Not here it doesn't -:)

Regards,
Peter T


"p45cal" wrote in message
...

the likes of:


VBA Code:
--------------------


Range("A1:M200")=Range("A1:M200").value
--------------------



seems to work here.


JoeBoynton;705352 Wrote:

Hi,
I need help on how to automate the conversion of a range of

Excel


--
p45cal

*p45cal*

------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?u=558
View this thread: 'Excel Convert text to Number - The Code Cage

Forums' (http://www.thecodecage.com/forumz/sh...d.php?t=197375)

'Microsoft Office Help - Microsoft Office Discussion - Excel VBA

Programming - Access Programming' (http://www.thecodecage.com/forumz)

.



--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?u=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=197375

http://www.thecodecage.com/forumz