![]() |
Can I make cell completion mandatory in excel?
Excel 2000
|
You can set up your workbook so that it will not allow
the user to close the workbook without filling in certain cell. For example: Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim checkRng As Range Set checkRng = Sheets("Sheet1").Range("A1") If checkRng.Value = "" Then Cancel = True MsgBox "Please fill in " & _ checkRng.Address(False, False) & "." End If End Sub --- Place this in the ThisWorkbook module of your workbook. HTH Jason Atlanta, GA -----Original Message----- Excel 2000 . |
Just a thought...
Maybe this would be better in the _beforeSave event. Then the user can open and close without having to fill in A1. And with the _beforeclose event, I can save with A1 empty, fill in A1, close (without saving). Jason Morin wrote: You can set up your workbook so that it will not allow the user to close the workbook without filling in certain cell. For example: Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim checkRng As Range Set checkRng = Sheets("Sheet1").Range("A1") If checkRng.Value = "" Then Cancel = True MsgBox "Please fill in " & _ checkRng.Address(False, False) & "." End If End Sub --- Place this in the ThisWorkbook module of your workbook. HTH Jason Atlanta, GA -----Original Message----- Excel 2000 . -- Dave Peterson |
Yes, I wasn't sure which event made more sense. I suppose
if I had tested them both I would have reached the same conclusions. -----Original Message----- Just a thought... Maybe this would be better in the _beforeSave event. Then the user can open and close without having to fill in A1. And with the _beforeclose event, I can save with A1 empty, fill in A1, close (without saving). Jason Morin wrote: You can set up your workbook so that it will not allow the user to close the workbook without filling in certain cell. For example: Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim checkRng As Range Set checkRng = Sheets("Sheet1").Range("A1") If checkRng.Value = "" Then Cancel = True MsgBox "Please fill in " & _ checkRng.Address(False, False) & "." End If End Sub --- Place this in the ThisWorkbook module of your workbook. HTH Jason Atlanta, GA -----Original Message----- Excel 2000 . -- Dave Peterson . |
All times are GMT +1. The time now is 08:43 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com