+ Reply to Thread
Results 1 to 4 of 4

If cell is empty then run macro otherwise skip this macro

  1. #1
    alexmillner@gmail.com
    Guest

    If cell is empty then run macro otherwise skip this macro

    Hi -
    I have a ton of data that I have built a macro (Macro 1) for assuming
    that all the data was going to be in the same location in each
    spreadsheet. Of course it turns out some sheets are different but they
    are all different in the same way. So, I built another macro (Macro2)
    that moves the data back over to correspond with Macro1 but now I need
    another macro that will decide whether or not Macro 2 needs to be run.

    So the sheets with the data in the wrong location all have column Q4-14
    blank and the columns are not blank in the correct data... so the macro
    needs to say something like this:

    If the cell.value of Q4 = blank, then run macro 2, otherwise run macro1

    Sorry, I know this is easy but I can't figure it out. Any help would be
    appreciated.

    Thanks
    Alex


  2. #2
    alexmillner@gmail.com
    Guest

    Re: If cell is empty then run macro otherwise skip this macro

    Or I guess it can say
    If cell.value of Q4=blank then go to next step, otherwise stop this
    macro


  3. #3
    Tom Ogilvy
    Guest

    RE: If cell is empty then run macro otherwise skip this macro

    Don't you want to always run macro1, but you sometimes want to run macro2
    first:


    if Range("Q4").Value = "" then
    macro2
    End if
    macro1

    or to check all the cells in Q4:Q14:

    if application.CountA(Range("Q4:Q14")) = 0 then
    macro2
    End if
    macro1

    --
    Regards,
    Tom Ogilvy


    "alexmillner@gmail.com" wrote:

    > Hi -
    > I have a ton of data that I have built a macro (Macro 1) for assuming
    > that all the data was going to be in the same location in each
    > spreadsheet. Of course it turns out some sheets are different but they
    > are all different in the same way. So, I built another macro (Macro2)
    > that moves the data back over to correspond with Macro1 but now I need
    > another macro that will decide whether or not Macro 2 needs to be run.
    >
    > So the sheets with the data in the wrong location all have column Q4-14
    > blank and the columns are not blank in the correct data... so the macro
    > needs to say something like this:
    >
    > If the cell.value of Q4 = blank, then run macro 2, otherwise run macro1
    >
    > Sorry, I know this is easy but I can't figure it out. Any help would be
    > appreciated.
    >
    > Thanks
    > Alex
    >
    >


  4. #4
    alexmillner@gmail.com
    Guest

    Re: If cell is empty then run macro otherwise skip this macro

    Thank you very much Tom. You're great!


+ 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