我有一组看起来像这样的代码,我在第1行搜索特定的单词,并希望返回找到它的列号:
Dim MyRng As Range
Dim MySht As Worksheet
Set MySht = ThisWorkbook.Sheets("Numbers")
Set MyRng = MySht.Rows(1).Find("Header 3" etc...)
FindSeriesColumn = MyRng.Column
似乎合乎逻辑的是,我应该能够消除定义工作表对象的需要,并且应该能够执行以下操作:
Dim MyRng As Range
Set MyRng = ThisWorkbook.Sheets("Numbers").Rows(1).Find("Header 3" etc...)
FindSeriesColumn = MyRng.Column
但是,Set MyRng ...
行会导致错误。使用ThisWorkbook.Sheets("Sheet Name").Rows(1).Find...
的不当之处是什么?
答案 0 :(得分:0)
使用此表格:
C:\Mono\lib\mono\4.5\Microsoft.CSharp.targets (CoreCompile target) ->
CSC: error CS2011: Unable to open response file: C:\Program
修改#1:强>
定义要检查的范围更容易,并在该范围开始后启动 Find():
Sub fhksadf()
Dim MyRng As Range
Set MyRng = ThisWorkbook.Sheets("Numbers").Rows(1).Find(what:="Header 3")
FindSeriesColumn = MyRng.Column
MsgBox FindSeriesColumn
End Sub