美好的一天,我的查找函数找不到合并的单元格,但不能使用列A中的合并单元格。它会抛出运行时错误“91”,对象变量或“未设置块变量”。
Ret1 = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*", _
, "Please select file")
If Ret1 = False Then Exit Sub
Set wb2 = Workbooks.Open(Ret1)
With wb2.Sheets(1)
firstrow = .Range("A:A").find(what:="Total", after:=.Range("A1")).Row + 1
End With
答案 0 :(得分:-1)
以下内容应该为您解决该问题:
With wb2.Sheets(1)
firstrow = .Range("A:A").find(what:="Total", after:=.Range("A1")).MergeArea.Cells(1,1).Row + 1
End With