VBA Excel:如何从固定单元格中进行选择,直到找到文本?

VBA Excel:如何从固定单元格中进行选择,直到找到文本?,excel,vba,range,selection-sort,Excel,Vba,Range,Selection Sort,我需要从单元格“A8”中选择一个包含单词“endofsample”的单元格。 这个词可以出现在工作表中的任何地方。这对我很有用 Sub test() Set INFO = Cells.Find(What:="endofsample", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _

我需要从单元格“A8”中选择一个包含单词“endofsample”的单元格。 这个词可以出现在工作表中的任何地方。

这对我很有用

Sub test()
    Set INFO = Cells.Find(What:="endofsample", After:=ActiveCell, LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False)
    If INFO Is Nothing Then
    Else
    End If

    INFO.Select
    Range("A8", ActiveCell).Select
End Sub

在VBA中,您可以使用
Find()
查找要查找的单词。查看文档以获取有关该功能的帮助。这在superuser.com上比这里更重要。