[英]Convert Currency to Number in Excel VBA
Whenever I try to do any calculations on a cell that is in the NIS (New Israel Shekels) currency format, I get an error 13 type mismatch.每当我尝试对 NIS(新以色列谢克尔)货币格式的单元格进行任何计算时,我都会收到错误 13 类型不匹配。 With the USD $ everything works fine.使用美元,一切正常。
I want to do calculations on a currency formatted cell in VBA.我想在 VBA 中对货币格式的单元格进行计算。 For example例如
Target = Target * -1
Why would this not work with a currency other than $?为什么这不适用于 $ 以外的货币?
Is there any reason the variable you are using is Target.value
instead of just Target
?您使用的变量是否有任何原因是Target.value
而不仅仅是Target
?
The following worked for me in a currency formmated cell:以下在货币格式的单元格中对我有用:
Dim Target As Variant
'Currency Formated Cell
Set Target = Cells(6, 14)
Target = Target * 2
'Printed the calculation
Cells(7, 14) = Target
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.