ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Warning upon closing sheet (https://www.excelbanter.com/excel-worksheet-functions/184554-warning-upon-closing-sheet.html)

stevieboy1313

Warning upon closing sheet
 
I have read some suggestions for a pop-up box when opening a sheet, but how
can I create a message box that appears when you close the worksheet? Any
help will be appreciated.

Mike H

Warning upon closing sheet
 
Hi,

Right click the sheet tab, double click the appropriate sheet and paste this
in.

Private Sub Worksheet_Deactivate()
MsgBox "Your closing thid sheet!!"
End Sub

Mike

"stevieboy1313" wrote:

I have read some suggestions for a pop-up box when opening a sheet, but how
can I create a message box that appears when you close the worksheet? Any
help will be appreciated.


Gary''s Student

Warning upon closing sheet
 
Put this macro in the workbook code area:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
MsgBox ("YOU HAVE BEEN WARNED!!!!")
End Sub

--
Gary''s Student - gsnu200781


"stevieboy1313" wrote:

I have read some suggestions for a pop-up box when opening a sheet, but how
can I create a message box that appears when you close the worksheet? Any
help will be appreciated.


Mike H

Warning upon closing sheet
 

Hi,

I should have said, Right click the sheet tab, view code, double click the
appropriate sheet and paste the code in.

Mike


"stevieboy1313" wrote:

I have read some suggestions for a pop-up box when opening a sheet, but how
can I create a message box that appears when you close the worksheet? Any
help will be appreciated.


stevieboy1313

Warning upon closing sheet
 
Thank you very much folks, but I couldn't get it to work. The sheet just
closed like always.

"Mike H" wrote:


Hi,

I should have said, Right click the sheet tab, view code, double click the
appropriate sheet and paste the code in.

Mike


"stevieboy1313" wrote:

I have read some suggestions for a pop-up box when opening a sheet, but how
can I create a message box that appears when you close the worksheet? Any
help will be appreciated.


Mike H

Warning upon closing sheet
 
Hi,

If you followed the guidance for instaling the macro and I suggest you
re-read and try again and it still doesn't work then macros may be disabled
so try enabling them

Mike

"stevieboy1313" wrote:

Thank you very much folks, but I couldn't get it to work. The sheet just
closed like always.

"Mike H" wrote:


Hi,

I should have said, Right click the sheet tab, view code, double click the
appropriate sheet and paste the code in.

Mike


"stevieboy1313" wrote:

I have read some suggestions for a pop-up box when opening a sheet, but how
can I create a message box that appears when you close the worksheet? Any
help will be appreciated.


Gord Dibben

Warning upon closing sheet
 
Right-click on the Excel Icon left of "File" on the menubar.

Select "View Code" and paste G'sS's code into that module.

Do not place it in a sheet module as Mike suggested.

Workbook_BeforeClose events do not run from worksheets but Mike may have been
confused by your referring to a workbook as a "worksheet"

Workbooks can contain one or more worksheets. You cannot "close" or "open" a
worksheet.

You can however "deactivate" or "activate" worksheets and run sheet event code.


Gord Dibben MS Excel MVP

On Mon, 21 Apr 2008 11:41:01 -0700, stevieboy1313
wrote:

Thank you very much folks, but I couldn't get it to work. The sheet just
closed like always.

"Mike H" wrote:


Hi,

I should have said, Right click the sheet tab, view code, double click the
appropriate sheet and paste the code in.

Mike


"stevieboy1313" wrote:

I have read some suggestions for a pop-up box when opening a sheet, but how
can I create a message box that appears when you close the worksheet? Any
help will be appreciated.




All times are GMT +1. The time now is 06:55 AM.

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