Sheet.Select is not working - why?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have written code as below:
Private Sub Worksheet_Deactivate()
Dim sh, Target
On Error GoTo ErrorHandler
sh = ActiveSheet.CodeName
Application.EnableEvents = False
CompSel
Debug.Print sh
MsgBox sh & ".Select"
sh.Select
' Sheet5.Select
ErrorHandler:
Application.EnableEvents = True
End Sub

Why this code does not accept "sh.Select" but "Sheet5.Select" is OK. "MsgBox
sh & ".Select"" gives exatly same output.

Thanks
MakeLei
 
Back
Top