Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 160
Default Before Save Requirement

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"

wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bedroom Requirement robzrob Excel Worksheet Functions 8 June 29th 08 07:32 PM
Critical requirement. Christopher Naveen[_2_] Excel Worksheet Functions 3 June 22nd 08 01:19 PM
Sum with special requirement firroo Excel Worksheet Functions 2 May 29th 08 09:48 AM
Fulfilling a sum requirement Dave Excel Discussion (Misc queries) 1 August 22nd 07 05:55 PM
Requirement in Bar chart rajeshkumar Charts and Charting in Excel 0 November 9th 05 05:29 PM


All times are GMT +1. The time now is 03:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"