Find a string in the column and active application Go to

Viewed 49

I need to find a string that will be always on the Row 3 but any column in a specific sheet, after the code find it the application GoTo should take the user to this column. However, I am having trouble with my code, maybe someone knows what I am doing wrong?

Sub Pivot1()

    Dim SearchString As String
Dim SearchRange As Range, cl As Range
Dim FirstFound As String
Dim sh As Worksheet

' Set Search value
SearchString = "Nr. 1"
Application.FindFormat.Clear

With Sheets("Analysis").Cells(3, Columns.Count).End(xlToLeft).Column
    Set cl = .Find(What:=SearchString, After:=Range("A:FA"), LookIn:=xlValues, _
                   lookat:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
                   MatchCase:=False, SearchFormat:=False)
    If Not cl Is Nothing Then Application.Goto cl
       End With

  End Sub
0 Answers
Related