PC Review


Reply
Thread Tools Rate Thread

Before Save Requirement

 
 
Phil Hageman
Guest
Posts: n/a
 
      12th Jan 2004
A user opens a workbook and is requiared to make entries
in certain cells, say A1, B2, C3 and D4. I need code that
prevents them from saving the workbook with these four
cells blank. If one or more are blank, a message informs
them of the oversight. Once corrected, they may save the
workbook. What would the code be?

Thanks, Phil
 
Reply With Quote
 
 
 
 
Township of East Hanover
Guest
Posts: n/a
 
      12th Jan 2004
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Sheet1.Cell(1,1).Value = " " then
MsgBox("Please Enter a value in Cell
A1",vbExclamation+vbOK,"Problem!")
Cancel = True
Else
Cancel = False
end If
If Sheet1.Cell(2,1).Value = " " then
........
End If
.........

End Sub


"Phil Hageman" <(E-Mail Removed)> wrote in message
news:0c3c01c3d93c$f3019c20$(E-Mail Removed)...
> A user opens a workbook and is requiared to make entries
> in certain cells, say A1, B2, C3 and D4. I need code that
> prevents them from saving the workbook with these four
> cells blank. If one or more are blank, a message informs
> them of the oversight. Once corrected, they may save the
> workbook. What would the code be?
>
> Thanks, Phil



 
Reply With Quote
 
Phil Hageman
Guest
Posts: n/a
 
      12th Jan 2004
I have entered the code and get a compile syntax error on
this line:

MsgBox("A value greater than zero is required _
for Customer weighting",vbExclamation+vbOK, _
"Data Entry Problem!") <----ENTIRE LINE HIGHLIHTED

The following code is how I have set up the closing
sequence. Should all this code be compressed into one
Sub, or be separate? I'm trying to give the user two
choices: fix the problem, or close without saving.

Option Explicit
----------------------------------------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Sheet2("Scorecard").Cell(7, 26).Value = " " Then
MsgBox("A value greater than zero is required _
for Customer weighting",vbExclamation+vbOK,"Data
Entry Problem!")
Cancel = True **I plan to add three
Else **additional cells to this.
Cancel = False **How would this be modified?
End If **Or would I repeat the code?
End Sub
---------------------------------------------------------
Sub Auto_Close()
Application.DisplayFullScreen = False
ActiveWindow.DisplayWorkbookTabs = True
ActiveWindow.DisplayHeadings = True
ActiveWindow.DisplayHorizontalScrollBar = True

End Sub



>-----Original Message-----
>Private Sub Workbook_BeforeClose(Cancel As Boolean)
> If Sheet1.Cell(1,1).Value = " " then
> MsgBox("Please Enter a value in Cell
>A1",vbExclamation+vbOK,"Problem!")
> Cancel = True
> Else
> Cancel = False
> end If
> If Sheet1.Cell(2,1).Value = " " then
> ........
> End If
> .........
>
>End Sub
>
>
>"Phil Hageman" <(E-Mail Removed)>

wrote in message
>news:0c3c01c3d93c$f3019c20$(E-Mail Removed)...
>> A user opens a workbook and is requiared to make entries
>> in certain cells, say A1, B2, C3 and D4. I need code

that
>> prevents them from saving the workbook with these four
>> cells blank. If one or more are blank, a message

informs
>> them of the oversight. Once corrected, they may save

the
>> workbook. What would the code be?
>>
>> Thanks, Phil

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Requirement to Save As When Opening a Database lu Microsoft Access Security 3 27th Apr 2008 09:19 AM
Does PC where C# app wii run have requirement? Microsoft C# .NET 2 16th Nov 2003 10:04 PM
RE: Requirement to save file =?Utf-8?B?SmltIFBhZ2V0?= Microsoft Word New Users 1 6th Nov 2003 02:18 AM
Re: Requirement to save file Suzanne S. Barnhill Microsoft Word New Users 0 11th Sep 2003 04:48 PM
Re: Requirement to save file Suzanne S. Barnhill Microsoft Word New Users 0 11th Sep 2003 04:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:59 AM.