Listen to "rename sheet" event in excel

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi

I'd like to create a listener on the event "sheet.name changing". It
apparently does not exist in vba worksheet standard callbacks.
(said in a different way I want to run a function any time a specific
sheet has its name manually changed)
Any idea ? Any help would be appreciated.

Thanks
 
Not ideal, but this will pick it up on the next cell select

Private mSheet As String

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If mSheet <> "" Then
If Me.Name <> mSheet Then
MsgBox "Sheet name changed from " & mSheet
End If
End If
mSheet = Me.Name
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top