View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Earl Kiosterud Earl Kiosterud is offline
external usenet poster
 
Posts: 611
Default 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