Greetings vijyat,
This would be another way.
In Sheet1's Module:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
'// This is in case you want to jump to A1 of the selected sheet, //
'// upon making a selection in the Data Validation drop-down. //
'// Ensure we are only running when just one cell changes, and that this //
'// cell is the one with the data validation. (I chose C1 to put the DV in. //
If Target.Count = 1 Then
If Target.Address = Me.Cells(3).Address Then
'// A safety to ensure the sheet exists. //
If SheetExists(Me.Cells(3).Value) Then
'// Jump to the sheet/cell desired //
Application.Goto ThisWorkbook.Worksheets(Me.Cells(3).Value).Range("A1"), True
End If
End If
End If
End Sub
Private Function SheetExists(SheetName As String) As Boolean
'// Override/ignore the error raised if the sheet does not exist, //
'// in which case SheetExists will remain FALSE. //
On Error Resume Next
SheetExists = ThisWorkbook.Worksheets(SheetName).Name = SheetName
On Error GoTo 0
End Function
I chose cell C1 on Sheet1 for the DV. We could populate the DV's List when the workbook opens.
In ThisWorkbook Module:
Option Explicit
Private Sub Workbook_Open()
Dim strSheetNames As String
Dim wks As Worksheet
'// For each visible sheet in the workbook, concatenate the sheet names //
'// together, for our DV List argument. //
For Each wks In ThisWorkbook.Worksheets
If wks.Visible = xlSheetVisible Then
strSheetNames = strSheetNames & wks.Name & ","
End If
Next
'// Then strip the last comma off the string. //
strSheetNames = Left$(strSheetNames, Len(strSheetNames) - 1)
'// Create the DV in C1 of Sheet1 //
With Sheet1.Range("C1").Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, _
Formula1:=strSheetNames
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub
Hope that helps,
Mark