“无法设置Range类的NumberFormat属性”(“Unable to set the NumberFormat property of the Range class”)

编程入门 行业动态 更新时间:2024-10-27 10:29:21
“无法设置Range类的NumberFormat属性”(“Unable to set the NumberFormat property of the Range class”)

此代码已经工作了很长时间。 我想也许我意外地按了一把钥匙,但我似乎无法看到它。 我突然得到错误:

无法设置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

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:

Unable to set the NumberFormat property of the Range class

in the below code:

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中收到“ Too many different cells formats ”错误消息

主题:您在Excel中收到“太多不同的单元格格式”错误消息

链接 : http : //support.microsoft.com/kb/213904

从上面的链接中引用

在Microsoft Excel 2007/2010文件中可能会生成以下错误消息;

Excel在文件中找到了不可读的内容

当工作簿在Excel 2003中包含超过大约4,000种不同的单元格格式组合或在Excel 2007及更高版本中包含64,000时,会出现此问题。

链接中提到的解决方案是下载并运行XLStyesTool

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

Solution

Topic: You receive a "Too many different cell formats" error message in Excel

Link: http://support.microsoft.com/kb/213904

QUOTE from the above link

In Microsoft Excel 2007/2010 files may produce the following error message;

Excel found unreadable content in the file

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.

Solution as mentioned in the link is to download and run the XLStyesTool

更多推荐

本文发布于:2023-07-15 21:52:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1119291.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   NumberFormat   Range   Unable   class

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!