+ Reply to Thread
Results 1 to 3 of 3

Trouble with if else then macro

  1. #1
    Registered User
    Join Date
    04-08-2015
    Location
    Auckland
    MS-Off Ver
    2013
    Posts
    1

    Trouble with if else then macro

    Hi all,

    I am trying to code a macro that first checks cells B4,C4,D4 and E4 to check they have been filled in. If they haven't a msgbox should pop up prompting to fill in required cells. If the cells are filled in the various functions in the recorded macro should run.

    Note, All relevant columns have data validation applied.

    I have tried several methods. IsNull() with OR for the various cells, B4=""..., B4=0.. etc. but I can't seem to get it to work correctly.

    In the code below, if the cells are empty the msgbox comes up however even when the cells are completed the msgbox comes up and the macro does not run the Else portion of the code.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 04-08-2015 at 10:13 PM.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Trouble with if else then macro

    Hello,

    Here's a suggestion (with a bit of code clean up).
    (warning : not tested !)

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,543

    Re: Trouble with if else then macro

    Or:
    Please Login or Register  to view this content.

+ 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 for turning columns into rows
    By Shanehickey2497 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2013, 01:08 AM
  2. Macro Trouble
    By tonychopra194 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-30-2012, 02:57 AM
  3. Trouble with If-Then-Else in a VBA Macro
    By garden_gnome in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-07-2012, 04:17 PM
  4. Replies: 0
    Last Post: 08-26-2010, 11:49 AM
  5. MACRO TROUBLE
    By HELP in forum Excel General
    Replies: 2
    Last Post: 06-07-2006, 11:15 AM

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