我有一个变量startingRow
startingRow = 36
我想使用Cells.Find函数搜索发生问题的第36行之后的第一行。我该如何完成?
foundRow = wksDreamSheet.Cells.Find("Summa/Snitt", 36, , , xlByRows, xlNext).Row
试试这个:
startingRow = 36
With wksDreamSheet
Set rng = .Range(startingRow & ":" & .Rows.Count).Find("Summa/Snitt", , , , xlByRows, xlNext)
End With
或更可靠:
Dim rng As Range
startingRow = 36
With wksDreamSheet
Set rng = .Range(startingRow & ":" & .Rows.Count).Find("Summa/Snitt", , , , xlByRows, xlNext)
End With
If Not rng Is Nothing Then
foundRow = rng.Row
Else
foundRow = 1 ' or any other number (or msgbox with error)
End If
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句