ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error setting number format (https://www.excelbanter.com/excel-programming/342100-error-setting-number-format.html)

Bill Sturdevant[_2_]

Error setting number format
 
But only in Switzerland!!!

I am using the following code to set the NumberFormat of some cells in a
macro on my machine here in the U.S.:

If sColumn(i) = "L" Or sColumn(i) = "M" Then
DestCell = sColumn(i) & LTrim$(Str$(lWIPRow))
Range(DestCell).NumberFormat = myNumberFormat
End If

DestCell ends up being something like "L11" and myNumberFormat was picked up
from a cell where there was a valid Date-style numberformat.

When my colleague runs the exact same code in Switzerland, he gets a runtime
error '1004': Unable to set NumberFormat property of the Range class.

For him, DestCell ends up being something like "L11" and myNumberFormat was
picked up from a cell where there was a valid Date-style numberformat, though
in his regional style for dates.

The only other thing we can think of is he has Office 2002 and I have Office
2003. He wrote the original code and sent it to me and I simply added the
instructions shown above, so the rest of the code runs correctly on both
machines.


All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com