PDA

View Full Version : Solved: Popup messages when clicking on a tab



thomas.szwed
12-06-2007, 10:30 AM
Hello again!

Does anyone have of know of any code that enables a message box to pop up everytime you click on a tab in a workbook...? Would this code be held in the sheet's code file under Microsoft Excel Objects in VB editor???

Many THanks.......Again!

Simon Lloyd
12-06-2007, 11:08 AM
Try this:

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
MsgBox "You have selected " & ActiveSheet.Name
End Sub
it goes in the ThisWorkBook module get there by presseing Alt+F11, right click ThisWorkbook on the left hand side choose view code and then paste the code above in to that module!

marshybid
12-07-2007, 04:56 AM
Hi, I like the option of having a po-up message box by individual worksheet. How would I add this code to an existing sub??:dunno

Thanks,

Marshybid

Simon Lloyd
12-07-2007, 05:56 AM
just put the code in the individual worksheets module