“无法设置Range类的NumberFormat属性” [英] "Unable to set the NumberFormat property of the Range class"
问题描述
这段代码一直在工作。我以为也许我不小心按了一个键,但似乎看不到它。我突然得到错误:
This code has been working for ages. I thought maybe I accidently pressed a key but I cannot seem to see it. I suddenly get the error:
无法设置Range类的NumberFormat属性
在下面的代码中:
Worksheets("Sheet1").Cells(y + k, x + j).Select
TempValue = Worksheets("Sheet1").Cells(y + k, x + j).Value
Worksheets("Sheet1").Cells(y + k, x + j).NumberFormat = "#,##0" //ERROR HERE
Worksheets("Sheet1").Cells(y + k, x + j).Value = TempValue
推荐答案
在Chat中发现的问题是工作簿有超过64,000种格式,因为用户正在获得太多不同的单元格格式错误消息在Excel
The problem as discovered in Chat was the workbook had more than 64,000 formats because of which the user was getting the "Too many different cell formats" error message in Excel
解决方案
主题:您在Excel中收到太多不同的单元格格式错误消息
链接: http://support.microsoft.com/kb/213904
以上链接的QUOTE
在Microsoft Excel 2007 / 2010文件可能会产生以下错误消息:
In Microsoft Excel 2007/2010 files may produce the following error message;
Excel在文件中发现不可读内容
Excel found unreadable content in the file
该工作簿在Excel 2003中包含超过约4000种不同的单元格格式组合,或者在Excel 2007及更高版本中包含64,000种。
This problem occurs when the workbook contains more than approximately 4,000 different combinations of cell formats in Excel 2003 or 64,000 in Excel 2007 and higher.
链接中提到的解决方案是下载并运行 XLStyesTool
Solution as mentioned in the link is to download and run the XLStyesTool
这篇关于“无法设置Range类的NumberFormat属性”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!