Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Conditional Message Box

I am after using a before close statement to check a cell's value and show a
message box if true. This would apply across all of my worksheets.

I.E.

If C1 = False

Then Display C1 needs to be True

But then still let them close. As an aside is there any way to make sure a
front worksheet opens no matter on which worksheet it is closed?

Many thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Conditional Message Box


Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheets("Sheet1").Range("A1").Value = False Then
MsgBox "Invalid value"
End If
End Sub

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

"Adam Harding" wrote in message
...
I am after using a before close statement to check a cell's value and show

a
message box if true. This would apply across all of my worksheets.

I.E.

If C1 = False

Then Display C1 needs to be True

But then still let them close. As an aside is there any way to make sure

a
front worksheet opens no matter on which worksheet it is closed?

Many thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Conditional Message Box

Cheers Bob

"Bob Phillips" wrote:


Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheets("Sheet1").Range("A1").Value = False Then
MsgBox "Invalid value"
End If
End Sub

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

"Adam Harding" wrote in message
...
I am after using a before close statement to check a cell's value and show

a
message box if true. This would apply across all of my worksheets.

I.E.

If C1 = False

Then Display C1 needs to be True

But then still let them close. As an aside is there any way to make sure

a
front worksheet opens no matter on which worksheet it is closed?

Many thanks.




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
Conditional formatting with a prompt and new email message Tammy Excel Discussion (Misc queries) 1 December 21st 09 08:38 PM
#N/A message & Conditional format Ken Excel Discussion (Misc queries) 6 January 25th 07 06:34 PM
conditional formatting error message Karla V Excel Worksheet Functions 3 October 31st 06 03:37 AM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM
Displaying a message in a message box without requiring user to click anything to proceed Android[_2_] Excel Programming 2 June 25th 04 06:44 PM


All times are GMT +1. The time now is 04:03 PM.

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

About Us

"It's about Microsoft Excel"