I developed this code to select a worksheet named with the text of a cell on column B when I double click on it. But I am trying to increase my code with one IF condition: If there is no worksheet named with the cell I double clicked show a msgbox ("Hello") and after that create the worksheet with the name of the cell I double clicked.
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 2 Then
If Sheets(Target.Text) = True Then
Sheets(Target.Text).Visible = xlSheetVisible
Sheets(Target.Text).Select
Sheets(Target.Text).Range("A2").Select
Cancel = True
Else
MsgBox ("hello")
End If
End If
End Sub
This condition does not work as I thought If Sheets(Target.Text) = True Then