Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 17
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default 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.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 17
Default 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.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default 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.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 - Closing One Sheet at a Time? Charliec Excel Discussion (Misc queries) 4 October 22nd 07 01:13 PM
Add items to a combo box and make them available after closing the sheet [email protected] Excel Discussion (Misc queries) 1 June 25th 07 09:42 PM
Closing the current focused sheet Pietro Excel Discussion (Misc queries) 3 February 22nd 07 11:15 PM
How to prevent warning messages on protected work sheet. Dannycol Excel Worksheet Functions 3 April 5th 06 09:07 PM
What is the VBA code to delete a sheet without warning message? [email protected] Excel Discussion (Misc queries) 2 August 9th 05 04:16 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"