+ Reply to Thread
Results 1 to 6 of 6

To run or not to run - VBA Code

  1. #1
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    To run or not to run - VBA Code

    Hi All,

    I'm looking to add some code in the front of the below to pull up an error message if theres no data in cell D4 to format/filter and then end... message something like "There's no data to format".

    Please Login or Register  to view this content.
    Many thanks in advance

    Colin

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,992

    Re: To run or not to run - VBA Code

    After the With Sheets( ...:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: To run or not to run - VBA Code

    It still doesn't like that.. I now have the following code;

    Please Login or Register  to view this content.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,992

    Re: To run or not to run - VBA Code

    It still doesn't like that..
    What does that mean? Do you get an error? If yes, what? What line of code errors? Or does it just not do what you expect?

    You realise we have nothing to test any theories on, nor do we know what you expect the code to do.

    Regards, TMS

  5. #5
    Forum Contributor
    Join Date
    02-10-2012
    Location
    Newcastle upon Tyne
    MS-Off Ver
    Excel 2021
    Posts
    114

    Re: To run or not to run - VBA Code

    Test.xlsmYes I get the Error 424 and when debug is clicked ' .AutoFilter' is highlighted.

    please see the attached example - When i click 'RUN' I would like, if there's no data from row 4 to show and error "No Data to format" and if there is follow the rest of the code.

    thanks again for your help.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,992

    Re: To run or not to run - VBA Code

    Try:

    Please Login or Register  to view this content.

    Regards, TMS

+ 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