CopyFromRecordset text to numeric

A

andrei.kazakov

Hi,
how to recalculate text cell value after formating cell to numer?
....
cmd.CommandText ="select money(text value), money2(text value),
money3(text value) from money"
....
xlWs.Cells(1, 1).CopyFromRecordset(rs)
xlWs.Columns("A:A").NumberFormat = "0.00"
....

After executing values at cell looking like text(1.89898) but cell
formating is numer. After clicking the cell value changing to
numer(1.9) and you can count total money values. Is the is any way to
recalculate/change cells to be number?
--D.
 
D

Dick Kusleika

D

Try

xlWs.Columns(A:A).Value = xlWs.Columns(A:A).Value

after you change the NumberFormat.
 
N

NickHK

andrei,
Or convert in your SELECT statement, using CLng, CAST etc depending on the
DB.

NickHK
 
D

deilegium

xlWs.Columns(A:A).Value = xlWs.Columns(A:A).Value
That is working, unfortunatly at that situation i cant use cast,
convert function....but thanx for help
--D.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top