具有正确的十进制分隔符的Excel打印编号 [英] Excel Print number with correct decimal Seperator

查看:90
本文介绍了具有正确的十进制分隔符的Excel打印编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用打印功能将单元格值导出到csv文件。我在具有不同本地化设置的多台PC上使用此宏。我遇到的问题是,在某些PC上,其他计算机的输出是4,11和4.11。是否有任何格式方法,可以让我始终写一个以分号作为小数点分隔符的数字?

I use the print function to export a Cell Value to csv file. I use this macro on several PCs with different Localization Settings. The problem i am experiencing is, that on some PCs the Output is 4,11 and 4.11 on others. Is there any Format Method, that allows me always write a Number with a semicolon as decimal Seperator?

推荐答案

我知道,没有用于更改小数点分隔符的格式方法。相反,您的选择是暂时告诉Excel使用特殊字符或使用Replace()。

As far as I'm aware, there is no format method for changing the decimal separator. Instead your options are temporarily telling Excel to use a special character or using Replace().

Application.UseSystemSeparators = False
Application.DecimalSeparator = ";"
Print #1, rngValue.Text

Or

Print #1, Replace(rngValue, ",", ";") 

在任何一种情况下,当您读回数字时,您都会遇到一个问题,即将它们转换回正确的字符,以便将其视为数字。

In either case you then have a problem, when reading the numbers back in, of converting them back to the correct character so they are considered numbers.

一个更好的问题可能是使用逗号作为小数点分隔符的地方的程序员如何处理CSV文件中的十进制值?

A better question might be how do programmers in places that use the comma as the decimal separator handle decimal values in CSV files?

这篇关于具有正确的十进制分隔符的Excel打印编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆