Navigate sheets from dropdown list. and this error occured. please help

th9r

New Member
Joined
Jan 30, 2025
Messages
3
Office Version
  1. 365
  2. 2024
Platform
  1. Windows
  2. Web
Screenshot 2025-01-30 113755.jpg
 
IF whithout END IF, i think you must add END IF before END SUB, Try like this

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
    If Not Range("A2").Value = "" Then
            ThisWorkbook.Sheets(Range("A2").Value).Select
    End If
End Sub
 
Upvote 0
Hi welcome to forum

As you have a continuation ( _ ) after Then directive you need to remove the space in front of the next line

VBA Code:
If Not Application.Intersect(Range("A2"), Target) Is Nothing Then _
    ThisWorkbook.Sheets(Target.Value).Activate

Dave
 
Upvote 0
IF whithout END IF, i think you must add END IF before END SUB, Try like this

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
    If Not Range("A2").Value = "" Then
            ThisWorkbook.Sheets(Range("A2").Value).Select
    End If
End Sub
 
Upvote 0
IF whithout END IF, i think you must add END IF before END SUB, Try like this

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
    If Not Range("A2").Value = "" Then
            ThisWorkbook.Sheets(Range("A2").Value).Select
    End If
End Sub
thanks
 
Upvote 0

Forum statistics

Threads
1,226,859
Messages
6,193,397
Members
453,793
Latest member
MillionMonkeys

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top