Hi All,
I have a very basic vba IF statement problem.
The situation is that I have a bunch of sheets in excel, every sheet = 1 client
I want to create a search engine in an overview sheet, so you just have type the name of the client, press a vba button and it automatically goes to that sheet.
The name of the client can only be found on its personal client page, so nowhere else.
What i've done first is create a list with regular IF statements (non-vba), and the outcome is either "Goto" (the typed client name matches the client on sheet 1) or "Dontgo":
Column N Column O
Sheet 1: "Goto"
Sheet 2: "Dontgo"
Sheet 3: "Dontgo"
Sheet 4: "Dontgo"
etc.etc.
Now I have the following vba but it always stops at sheet 1 cell D2:F2, regardless of cell "O3" having "Goto" or "Dontgo".
Sub Search()
If Range("O3").Value = "Goto" Then
Application.Goto Sheets("1").Range("D2:F2"), True
ElseIf Range("O4").Value = "Goto" Then
Application.Goto Sheets("2").Range("D2:F2"), True
ElseIf Range("O5").Value = "Goto" Then
Application.Goto Sheets("3").Range("D2:F2"), True
ElseIf Range("O6").Value = "Goto" Then
Application.Goto Sheets("4").Range("D2:F2"), True
Ive tried making the value in "O3" a hard value, no difference.
Try Range.Select, no difference.
Any help is appreciated!
Jasper
Bookmarks