+ Reply to Thread
Results 1 to 5 of 5

Skip Section of Code if Filter Returns a Blank

  1. #1
    Registered User
    Join Date
    02-08-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Skip Section of Code if Filter Returns a Blank

    I have a spreadsheet which will collect a large amount of data throughout the year that I need to report on Monthly. However at present there is very little in there.
    I have written into my macro for it to copy select data remaining from three columns after 3 filters have been applied into another sheet. (the filters contain data from drop down lists so there is no possibility of anyone entering incorrect information.)

    The problem I am having is that if the applied filters return a blank the macro copies and pastes the entire column within the specified datarange. Can anyone assist me in some sort of If/Else statement that will have it do nothing if the filter returns a blank and move onto the next section of code.
    I have included the problem code below.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 02-08-2013 at 03:31 AM. Reason: Added code tags, as per forum rules. Don't forget!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Skip Section of Code if Filter Returns a Blank

    This will test if there is any visible rows with data in column A below row 7

    Please Login or Register  to view this content.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Skip Section of Code if Filter Returns a Blank

    Same solution as AlphaFrog, but I can't leave all that "selecting" in there:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    02-08-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Skip Section of Code if Filter Returns a Blank

    Thank you, problem solved.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Skip Section of Code if Filter Returns a Blank

    I have marked this thread solved for you.
    In the future please select Thread Tools from the menu above and mark the thread as solved. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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