ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A msgbox appears on sheet level once, and only once (https://www.excelbanter.com/excel-programming/367807-msgbox-appears-sheet-level-once-only-once.html)

Who I Am

A msgbox appears on sheet level once, and only once
 
I want to put a note by Worksheet_SelectionChange on a worksheet, like
msgbox, to warn the users when they activate that sheet.

But I want that note appears only once, that is, the first time after
the workbook is open and the worksheet is clicked. I do not want to see
that every time the user returns the that worksheet, he is annoyed.

Any ideas?

Thanks in advance.


Snake Plissken[_2_]

A msgbox appears on sheet level once, and only once
 
add a variable on modul level then
in workbooks open event set its value that would store info about msgbox
appearence (e.g. string variable set to "N") - after selection you will
check wheather this value is set to "N" - if so the msg appear and the value
of that variable would be changed to "Y"



Tom Hutchins

A msgbox appears on sheet level once, and only once
 
Same basic idea as Snake, but I would declare a Boolean (true/false) variable
in the code module for the sheet in question, and I would use the
Worksheet_Activate event rather than Worksheet_SelectionChange.

Dim BeenHere As Boolean

Private Sub Worksheet_Activate()
If IsNull(BeenHere) Then
BeenHere = False
End If
If BeenHere = False Then
MsgBox "First time"
BeenHere = True
End If
End Sub

Hope this helps,

Hutch

"Snake Plissken" wrote:

add a variable on modul level then
in workbooks open event set its value that would store info about msgbox
appearence (e.g. string variable set to "N") - after selection you will
check wheather this value is set to "N" - if so the msg appear and the value
of that variable would be changed to "Y"





All times are GMT +1. The time now is 11:13 PM.

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