Excel:ClearContent保留公式

在Excel中,VBA有一种方法可以安全地使用Range("A1:B2").ClearContent而不删除单元格中现有的公式?

只是为了让我的情景更清晰:我从数据库中提取新数据,只想删除表单上的所有内容,而不是公式,因为这些将使用vlookupsparsing其他字段中的某些数据。

使用SpecialCells属性只获取常量值。

 Sub RemoveConstants() Dim rConstants As Range Set rConstants = Sheet1.Range("A1:B2").SpecialCells(xlCellTypeConstants) rConstants.ClearContents End Sub