Limit decimal places with Excel automation

B

bavjean

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
 
A

Andi Mayer

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"
 
B

bavjean

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
 

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