+ Reply to Thread
Results 1 to 3 of 3

mutliple "beforesave" functions in same workbook

  1. #1
    Registered User
    Join Date
    10-16-2008
    Location
    St. Louis
    Posts
    6

    mutliple "beforesave" functions in same workbook

    ..again, thanks to this forum...great people....

    I have my VB code working great - spreadsheet now requires data entry in a specific cell and that requirement has been delayed until a certain date with a IF THEN statement. Thanks to all that helped!!

    I am now trying to broaden the "beforesave" requirement to multiple cells in the same workbook/worksheet. In the below VB statement, I don't know where to insert this additional command to require that a second cell have data entered into it before saving. The cell on the "Request for PTM" worksheet is H12.

    I would need a second message to appear relating to that specific cell as well; similiar to first message "Current Installed Irr. System Entry Required"

    Please Login or Register  to view this content.
    Thanks for all the great help!! You guys are awesome!!!
    Last edited by VBA Noob; 10-20-2008 at 03:27 PM.

  2. #2
    Registered User
    Join Date
    07-09-2004
    Posts
    7

    beforesave functions

    Hi billkelley

    If you are going to do the same thing twice in vba, it is worth trying to write a separate function for it that can be used both times. Here is my attempt:

    Please Login or Register  to view this content.
    As the function StillEmpty returns true or false, you can assign it straight to the Cancel variable.

  3. #3
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862
    Here's code for doing them individually (simple extension of your code, but means that each condition is check in sequence so code exits when it is met and the second condition - if appliable - would only be met on the second attempt to save):
    Please Login or Register  to view this content.
    And here's code for both at the same time:
    Please Login or Register  to view this content.
    There is a lot of literature out there about validating data entry and while this sort of check is a good idea you need to be careful about over-using it because it means a user physically can't save the workbook in draft without meeting all your conditions (and if there are lots, then this can be annoying). Hope that helps. MM.
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro moves out of Active WorkBook. Why?
    By ulfah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2008, 01:14 PM
  2. using cell content to reference a worksheet tab name in second workbook
    By Conor in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2007, 09:32 AM
  3. Reference to a workbook
    By spreethi81 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-28-2007, 01:23 PM
  4. Querying Data within an Excel Workbook
    By snowbob23 in forum Excel General
    Replies: 0
    Last Post: 02-21-2007, 05:48 AM
  5. '02 Excel Workbook to Workbook...HELP!!!
    By shutterlug in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-01-2007, 11:12 PM

Tags for this Thread

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