VBA – 真或假,如果findstring

我试图得到一个 ,这取决于, 如果在工作表中find一个string “fal”。

Dim stress As Boolean If fal.UsedRange.Find("Approach = STRESS") > 0 Then stress = True Else stress = False End If 

它给出了一个“运行时错误'91':对象variables或没有设置块”

有任何想法吗?

尝试这个:

 Dim stress As Boolean stress = Not fal.UsedRange.Find("Approach = STRESS") Is Nothing