![]() |
Option Box on Workbook Close
I want to create an option box that opens when the value of a cell ="no"
which is populated when =if(A1=A2,"yes","no") when a user trys to close a workbook. The option box will have "yes" or "no" options where "yes" will go to cell A1 and "no" will close the workbook. |
Option Box on Workbook Close
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheets("Sheet1").Range("M1").Value = "yes" then '<==change M1 to suit Application.Goto Worksheets("Sheet1").Range("A1") Cancel = True End If 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 (there's no email, no snail mail, but somewhere should be gmail in my addy) "Tony" wrote in message ... I want to create an option box that opens when the value of a cell ="no" which is populated when =if(A1=A2,"yes","no") when a user trys to close a workbook. The option box will have "yes" or "no" options where "yes" will go to cell A1 and "no" will close the workbook. |
All times are GMT +1. The time now is 05:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com