Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Bedroom Requirement | Excel Worksheet Functions | |||
Critical requirement. | Excel Worksheet Functions | |||
Sum with special requirement | Excel Worksheet Functions | |||
Fulfilling a sum requirement | Excel Discussion (Misc queries) | |||
Requirement in Bar chart | Charts and Charting in Excel |