补充2楼: 如果区域中所有单元格均包含公式,则该属性值为 True;如果所有单元格均不包含公式,则该属性值为 False;其他情况下为 null。Variant 类型,只读。 语法 表达式.HasFormula 表达式 一个代表 Range 对象的变量。 示例
本示例提示用户选定 sheet1 的区域。如果该选定区域内所有单元格均包含公式,则本示例将显示消息框。 Visual Basic for Applications |
---|
Worksheets("Sheet1").Activate
Set rr = Application.InputBox( _
prompt:="Select a range on this worksheet", _
Type:=8)
If rr.HasFormula = True Then
MsgBox "Every cell in the selection contains a formula"
End If
|
|