ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display error? (https://www.excelbanter.com/excel-programming/321237-display-error.html)

PO

Display error?
 
Hi

Excel 2000.

I use a recordset (ADO) to retrieve and loop out data into a spreadsheet.
Everything works fine except for one thing - currency data is displayed as
string data (left-aligned) in the spreadsheet. After the data is looped out
into the spreadsheet I have to manually activate the cells (using F2) and
press ENTER. Only then are the numbers correctly formatted.

The datatype in the particular column in the recordset is vbDecimal. The
numberformat of the cell in the spreadsheet is "#,##0". I've tried to
convert the decimal datatype to currency (cCur) before looping it out with
the same negative result.

Any ideas?

Regards
PO



Michael Malinsky[_3_]

Display error?
 
There's probably a better way that someone will throw out here, but here's
one suggestion that I believe will work.

Add some code that will hit each cell in the particular column you need
fixed that will essentially do what you're doing now:

Sub Test()

Dim rng As Range, c As Variant

Set rng = Range("I:I")

For Each c In rng
c.Value = c.Value
Next c

End Sub

Of course, you would need to change the column as necessary.

"PO" <po wrote in message ...
Hi

Excel 2000.

I use a recordset (ADO) to retrieve and loop out data into a spreadsheet.
Everything works fine except for one thing - currency data is displayed as
string data (left-aligned) in the spreadsheet. After the data is looped

out
into the spreadsheet I have to manually activate the cells (using F2) and
press ENTER. Only then are the numbers correctly formatted.

The datatype in the particular column in the recordset is vbDecimal. The
numberformat of the cell in the spreadsheet is "#,##0". I've tried to
convert the decimal datatype to currency (cCur) before looping it out with
the same negative result.

Any ideas?

Regards
PO






All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com