+ Reply to Thread
Results 1 to 5 of 5

Need Help shortening Else/If statments

  1. #1
    Registered User
    Join Date
    10-07-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Question Need Help shortening Else/If statments

    I need to check multiple cell values to see if there is a value present in the cell prior to proceeding with the print action. I will be needing to add multiple additional cells to the following code, and am also wondering if I have a range such as AO15:AO16, if that can be entered into on one line instead of two.

    Also, if there is a better way to do this besides using 50 Else/If statements, it would truly save me headaches and code confusion.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,960

    Re: Need Help shortening Else/If statments

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Need Help shortening Else/If statments

    Hi there,

    Take a look at the attached workbook and see if it does what you need.

    Basically, the addresses of the cells which should be checked for missing data are listed in a table on the "Checks" worksheet, together with the error message which should be displayed if the cell is empty. The table will accommodade 25 address/message pairs, but this can be increased if necessary by changing the value in Cell B2 on the "Checks" worksheet.

    The VBA code loads the contents of the table into an array, and then scans through each pair of array elements - if no value is found in the cell whose address is listed in the array, the corresponding error message is displayed and the cell in question is selected so that the missing data can be entered immediately.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-07-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Need Help shortening Else/If statments

    @ ProtonLeah This works wonderfully, Thank you Much!
    @ Greg M, Website is not allowing me to view the document for some reason, perhaps it is my internet settings, but it keeps requiring me to "re-login"
    Last edited by kingkyle2005; 10-08-2013 at 11:07 AM.

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Need Help shortening Else/If statments

    Hi there,

    I've reposted my original post - maybe we'll be luckier with it this time!

    Hi there,

    Take a look at the attached workbook and see if it does what you need.

    Basically, the addresses of the cells which should be checked for missing data are listed in a table on the "Checks" worksheet, together with the error message which should be displayed if the cell is empty. The table will accommodade 25 address/message pairs, but this can be increased if necessary by changing the value in Cell B2 on the "Checks" worksheet.

    The VBA code loads the contents of the table into an array, and then scans through each pair of array elements - if no value is found in the cell whose address is listed in the array, the corresponding error message is displayed and the cell in question is selected so that the missing data can be entered immediately.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Greg M
    Attached Files Attached Files

+ 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. [SOLVED] Else If Statments VBA
    By mcaviney1987 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2013, 09:47 AM
  2. [SOLVED] IF statments
    By paddock in forum Excel General
    Replies: 2
    Last Post: 12-11-2012, 10:33 PM
  3. Nested IF statments
    By RJK42 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-09-2012, 08:08 PM
  4. [SOLVED] IF statments
    By krazygmtrk in forum Excel General
    Replies: 1
    Last Post: 11-05-2008, 07:05 PM
  5. More than 7 if statments
    By eXCELWANNABE in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-24-2008, 06:00 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