Hi i just wanne put some decimals into an Excel-Sheet
with the function
worksheet.range('A1').value := number;
But in excel there are only 2 decimal places all the time, but i really need 5 decimal places. In Navision this Variable has all the decimal places !
What should i do ?
0
Comments
worksheet.range('A1').Format := '#,##0.00000';
Depending on language Version you must enter the local number format (e.g. in Germany you need to use '#.##0,0000' instead of upper string.
You must use the Property "NumberFormat" instead of "Format" like shown below:
Range('C:G').NumberFormat := '#.##0,00000';
Another way is to use the Property NumberFormatLocal. As shown in VBA-Description the NumberFormat should be in international form #,##0.00 while NumberFormatLocal should be the local format code like '#.##,00'. But unlike in VBA in my tests only the local format did work in both properties.
Range.NumberFormatLocal := '#.##0';