Limit decimal places with Excel automation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everyone,

I was wondering if anybody could help with some Excel automation.

I have a form in Access, which exports the contents of a recordset to Excel
in the following manner:


objWS.Range("A2").CopyFromRecordset rstData, 1000
gobjExcel.Range("A1").Select

What I want to do, is check the contents of the exported data in Excel
automatically. If a cell contains a value with a decimal e.g. 123,456 then it
must make the value only with 1 decimal place, e.g 123,46
Note: I do not want to truncate the values before I export them to Excel.

Is there any easy way of doing this? Please help as I only started
automation recently.

Kind Regards,

Jean
 
Hello everyone,

I was wondering if anybody could help with some Excel automation.

I have a form in Access, which exports the contents of a recordset to Excel
in the following manner:


objWS.Range("A2").CopyFromRecordset rstData, 1000
gobjExcel.Range("A1").Select

What I want to do, is check the contents of the exported data in Excel
automatically. If a cell contains a value with a decimal e.g. 123,456 then it
must make the value only with 1 decimal place, e.g 123,46

??? this are two decimals

use range(xxx,yyy).numberformat="#,##0.00"
 
Hi Andi,

Thanks for the reply, but I am going to leave this piece of work out for
now, as it was getting to complicated.

Regards,
Jean
 
Back
Top