+ Reply to Thread
Results 1 to 3 of 3

Block saving unless a condition is met.

  1. #1
    Registered User
    Join Date
    10-25-2007
    Posts
    85

    Block saving unless a condition is met.

    Hello, I designed a sheet that essentially takes data inputs from manual data pulls for a given week. The problem is the data has to be pulled one day at a time and is subject to user error.

    Basically I want to prevent errors like this from causing a corruption of data in the reports that this sheet will feed. I want to put a check in that'll check the date on the data inputs and make sure they go sequentially from x to y. I could have this on a seperate tab, likely hidden. Using if then statements I'll simply have one cell that shows whether the sheet is a pass or fail. What I want to do is prevent saving the document or at the very least throw up an error box saying there is something wrong.

    Is there any way to do something like that?
    Last edited by Rgaherty; 07-22-2008 at 11:26 AM.

  2. #2
    Forum Contributor
    Join Date
    06-14-2008
    Posts
    153
    Hi,

    You need to put your check in the "Workbook_BeforeSave" event.

    1. Switch to visual basic editor.
    2. On the left pane double click on "Thisworkbook"
    3. On the right pane select "Workbook" from the left combo, then select "BeforeSave" from the right combo.
    4. Enter the following code between "Private Sub.." and "End Sub"
    Please Login or Register  to view this content.
    Modify the code to suit your condition and your message.

    Regards.
    Last edited by se1429; 07-22-2008 at 04:20 PM.
    Welcome to: http://www.exceldigest.com/myblog/
    "Excel help for the rest of us"

  3. #3
    Registered User
    Join Date
    10-25-2007
    Posts
    85
    Thank you very much that's what I was looking to do.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1