![]() |
Required cells??
I have a worksheet that we are using as a template.
The worksheet has cells we have made in to drop downs. Can these drop downs be setup as a "Reuired"?? Can certain cells be setup that if they are not complete the sheet won't save or a error message appears? Thanks in advance, TT |
Required cells??
What you need is a Workbook_BeforeSave event macro. You can write code into
this macro to do any checks you want and to display any messages you want. You can also write the code to cancel the Save command if certain checks are not satisfied. The cell addresses of the specific cells you want checked have to be written into the code or you have to setup a range of all those cells and name it. The following macro does what you want with a range of required cells named TheCells. This macro must be placed in the workbook module of your file. To do this, right-click on the Excel icon to the left of the word File in the menu at the top of your screen. Select View Code. Paste this macro into that module. If you wish, send me direct via email a valid email address and I will send you a small file that contains this macro properly placed. My email address is . Remove the "nop" from this address. HTH Otto "Tim T" wrote in message ... I have a worksheet that we are using as a template. The worksheet has cells we have made in to drop downs. Can these drop downs be setup as a "Reuired"?? Can certain cells be setup that if they are not complete the sheet won't save or a error message appears? Thanks in advance, TT |
Required cells??
Oops. Forgot to include the macro. Otto
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim i As Range Cancel = False SaveAsUI = False For Each i In Range("TheCells") If i = "" Then MsgBox "Cell " & i.Address(0, 0) & " must be filled in." Cancel = True Exit For End If Next i End Sub "Otto Moehrbach" wrote in message ... What you need is a Workbook_BeforeSave event macro. You can write code into this macro to do any checks you want and to display any messages you want. You can also write the code to cancel the Save command if certain checks are not satisfied. The cell addresses of the specific cells you want checked have to be written into the code or you have to setup a range of all those cells and name it. The following macro does what you want with a range of required cells named TheCells. This macro must be placed in the workbook module of your file. To do this, right-click on the Excel icon to the left of the word File in the menu at the top of your screen. Select View Code. Paste this macro into that module. If you wish, send me direct via email a valid email address and I will send you a small file that contains this macro properly placed. My email address is . Remove the "nop" from this address. HTH Otto "Tim T" wrote in message ... I have a worksheet that we are using as a template. The worksheet has cells we have made in to drop downs. Can these drop downs be setup as a "Reuired"?? Can certain cells be setup that if they are not complete the sheet won't save or a error message appears? Thanks in advance, TT |
All times are GMT +1. The time now is 10:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com