Warning before saving files!
OK - You guys were such a help with the last question. I have one more.
On the Excel worksheet (which is score sheet), I have two cells that should have some information, like name and adress, that should be put into them the 1st time I use the sheet. Sometimes I forget to do. Is there a way that if I try to save the file without having put the information into the cells, that Excel will warn me and tell me to input the data before saving? Thanks again. 24t42 |
Warning before saving files!
To get such a warning would require a macro. Here's a non-macro way.
Put this in a cell somewhere, formatted in a large red font. You can copy/paste it from here. =IF(AND(OR(NOT(ISBLANK(A2:B6))),OR(E1="",E2=""))," Name and Address required","") It's an array formula, so use Ctrl-Shift-Enter instead of Enter. Change the A2:B6 to the cells where you'll be entering scores. Change E1 and E2 to the cells for the name and address. If anything has been entered into A2:A6 and either E1 and/or E2 are empty, it will declare "Name and address required" loudly in red. -- Earl Kiosterud www.smokeylake.com ----------------------------------------------------------------------- wrote in message oups.com... OK - You guys were such a help with the last question. I have one more. On the Excel worksheet (which is score sheet), I have two cells that should have some information, like name and adress, that should be put into them the 1st time I use the sheet. Sometimes I forget to do. Is there a way that if I try to save the file without having put the information into the cells, that Excel will warn me and tell me to input the data before saving? Thanks again. 24t42 |
Warning before saving files!
I will try that later but I do not object to a macro. Is one way better
than another? 24t42 wrote: OK - You guys were such a help with the last question. I have one more. On the Excel worksheet (which is score sheet), I have two cells that should have some information, like name and adress, that should be put into them the 1st time I use the sheet. Sometimes I forget to do. Is there a way that if I try to save the file without having put the information into the cells, that Excel will warn me and tell me to input the data before saving? Thanks again. 24t42 |
Warning before saving files!
Your post is a response to your original post, not to mine, but I'm gonna
assume it was intended to be a response to mine, since I don't see any other responses. Posts don't always show up in these here parts! The macro solution will prompt the user when he attempts to save the workbook. My solution will nag him the moment he has started entering scores. Either will work, so it's a matter of which you prefer. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Worksheets("Sheet1").Range("E1") = "" Or Worksheets("Sheet1").Range("E2") = "" Then MsgBox "You must supply name and address before you save the scoresheet", vbOKOnly, "Save error" Cancel = True ' prevent saving End If End Sub Note that this will put the user in a trap if he doesn't have both the name and address, as he won't be able to proceed. The non-macro solution lets him know about the problem earlier, before he's entered a mess of score data. You could actually use both solutions. -- Earl Kiosterud www.smokeylake.com ----------------------------------------------------------------------- wrote in message ups.com... I will try that later but I do not object to a macro. Is one way better than another? 24t42 wrote: OK - You guys were such a help with the last question. I have one more. On the Excel worksheet (which is score sheet), I have two cells that should have some information, like name and adress, that should be put into them the 1st time I use the sheet. Sometimes I forget to do. Is there a way that if I try to save the file without having put the information into the cells, that Excel will warn me and tell me to input the data before saving? Thanks again. 24t42 |
Warning before saving files!
Thank you very much for your help. It must be a great feeling knowing
you helped someone. Thanks again! 24t42 Earl Kiosterud wrote: Your post is a response to your original post, not to mine, but I'm gonna assume it was intended to be a response to mine, since I don't see any other responses. Posts don't always show up in these here parts! The macro solution will prompt the user when he attempts to save the workbook. My solution will nag him the moment he has started entering scores. Either will work, so it's a matter of which you prefer. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Worksheets("Sheet1").Range("E1") = "" Or Worksheets("Sheet1").Range("E2") = "" Then MsgBox "You must supply name and address before you save the scoresheet", vbOKOnly, "Save error" Cancel = True ' prevent saving End If End Sub Note that this will put the user in a trap if he doesn't have both the name and address, as he won't be able to proceed. The non-macro solution lets him know about the problem earlier, before he's entered a mess of score data. You could actually use both solutions. -- Earl Kiosterud www.smokeylake.com ----------------------------------------------------------------------- wrote in message ups.com... I will try that later but I do not object to a macro. Is one way better than another? 24t42 wrote: OK - You guys were such a help with the last question. I have one more. On the Excel worksheet (which is score sheet), I have two cells that should have some information, like name and adress, that should be put into them the 1st time I use the sheet. Sometimes I forget to do. Is there a way that if I try to save the file without having put the information into the cells, that Excel will warn me and tell me to input the data before saving? Thanks again. 24t42 |
All times are GMT +1. The time now is 01:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com