ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Display MsgBox when selecting a sheet (https://www.excelbanter.com/excel-discussion-misc-queries/161735-display-msgbox-when-selecting-sheet.html)

Horatio J. Bilge, Jr.

Display MsgBox when selecting a sheet
 
Is there a way that I can have a message box display whenever a particular
sheet is selected?

Thanks,
~ Horatio

Mike H

Display MsgBox when selecting a sheet
 
Horatio,

Right click the sheet tab, view code and paste this in

Private Sub Worksheet_Activate()
msg = "You activated "
MsgBox msg & ActiveSheet.Name
End Sub

Mike

"Horatio J. Bilge, Jr." wrote:

Is there a way that I can have a message box display whenever a particular
sheet is selected?

Thanks,
~ Horatio


JW[_2_]

Display MsgBox when selecting a sheet
 
Right click on the sheet tad where you want this to happen and select
View Code. Then paste in the code below. Modify the message box as
needed.
Private Sub Worksheet_Activate()
MsgBox "your stuff here!"
End Sub

Horatio J. Bilge, Jr.
wrote:
Is there a way that I can have a message box display whenever a particular
sheet is selected?

Thanks,
~ Horatio



Horatio J. Bilge, Jr.

Display MsgBox when selecting a sheet
 
Thanks. It works great.
I was trying to use Workbook_SheetChange, but then I got the message for all
sheets, and I didn't know how to isolate the single sheet.

~ Horatio

"Mike H" wrote:

Horatio,

Right click the sheet tab, view code and paste this in

Private Sub Worksheet_Activate()
msg = "You activated "
MsgBox msg & ActiveSheet.Name
End Sub

Mike

"Horatio J. Bilge, Jr." wrote:

Is there a way that I can have a message box display whenever a particular
sheet is selected?

Thanks,
~ Horatio



All times are GMT +1. The time now is 11:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com