VBA宏不适用于ClearContentsNotFormulas [英] VBA Macro Not Working For ClearContentsNotFormulas

查看:87
本文介绍了VBA宏不适用于ClearContentsNotFormulas的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好: 我创建了一个宏,ClearContentsNotFormulas(见下文),在使用这个宏之前,我验证了具有我要清除的公式并保留公式的单元格中的数据是CellType = Values,但宏不起作用?

Hi:  I created a macro, ClearContentsNotFormulas (see below), and before using this macro, I validated that the data in the cells with formulas that I want to clear and leave the formulas is CellType = Values, but the macro does not work?

这些值是从不同的Excel文件粘贴链接的,当它出现在我的目标Excel文件中时,它们所在的单元格被格式化为"百分比"。 例如,53%(即所有"值"具有%符号)。

The values are paste linked from a different Excel file and when the appear in my target Excel file, the cells they are in are formatted as "Percentage."  For example, 53% (i.e., all "Values" have the % sign).

如何解决此问题。 我期待着您的回复并感谢您的帮助。

How do I fix this problem.  I look forward to your response and thanks for your help.

FrankHW

推荐答案

您对实际称为常量的值使用了不正确的参数(参数)。

You have used the incorrect parameter (argument) for the values which are actually referred to as constants.

Cells.SpecialCells(xlCellTypeConstants).ClearContents

Cells.SpecialCells(xlCellTypeConstants).ClearContents

请参阅以下链接了解xlCellType枚举

See the following link for the xlCellType enumeration

https://docs.microsoft.com/en-us/dotnet/api/microsoft.office。 interop.excel.xlcelltype?view = excel-pia


这篇关于VBA宏不适用于ClearContentsNotFormulas的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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