A msgbox appears on sheet level once, and only once

W

Who I Am

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.
 
S

Snake Plissken

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"
 
G

Guest

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
 

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

Top