I am trying to change the following code to open an existing WB depending on the result of cell H1. :
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address(0, 0) = "H1" And Target <> "" Then
Cancel = True
If Evaluate("isref('" & Target & "'!a1)") Then
Workheets(CStr(Target)).Select
'for opening new WB line below would be working. but it is not depending on result of H1!!
'Workbooks.Open "D:\ExcelVBA\341.xlsx"
Else
MsgBox "Sheet not found"
End If
End If
End Sub
Thanks
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address(0, 0) = "H1" And Target <> "" Then
Cancel = True
If Evaluate("isref('" & Target & "'!a1)") Then
Workheets(CStr(Target)).Select
'for opening new WB line below would be working. but it is not depending on result of H1!!
'Workbooks.Open "D:\ExcelVBA\341.xlsx"
Else
MsgBox "Sheet not found"
End If
End If
End Sub
Thanks