+ Reply to Thread
Results 1 to 9 of 9

VBA macto to filter by last workday

  1. #1
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Question VBA macto to filter by last workday

    Hi all,

    Is there a way to make a autofilterfilter to show the previous work day using VBA?

    I'm trying this:

    Please Login or Register  to view this content.
    I get the "Sub or Function not defined" but I don't know what's missing or even if this will give the result I want...

    Can someone help, please?

    Thanks

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,852

    Re: VBA macto to filter by last workday

    When you run the macro, and you get the error message, click on the debug button and advise us which line of code is highlighted.

    I suspect that this is where the issue is: ActiveSheet.Range("A$2:X:X")

    as this does not appear to be a valid range
    Last edited by alansidman; 06-12-2016 at 08:19 PM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: VBA macto to filter by last workday

    Hi Alan,

    ActiveSheet.Range("A$2:X:X") is working just fine for other macros running.

    When I debud it highlight the
    Please Login or Register  to view this content.
    part. I don't understand...

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,852

    Re: VBA macto to filter by last workday

    Without seeing your workbook along with the code installed, it is difficult to determine what is happening. You may want to upload a sanitized copy of your workbook for analysis.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window (or use the paperclip icon).

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA macto to filter by last workday

    This is where you go wrong.
    Please Login or Register  to view this content.
    Also why calculate last filled row if you're not using it ?
    Please Login or Register  to view this content.
    Last edited by bakerman2; 06-15-2016 at 08:47 PM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  6. #6
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: VBA macto to filter by last workday

    Hi bakerman2,

    Still no success

    Please see attached dummy files.
    All i want to do is to use to Tool workbook macro to filter the data in workbook Contract Tracker 2016.
    When clicking filter I want the table in Contract Tracker 2016 to only show the previous workday.

    This seams so simple to do by I'm going nuts. What am I doing wrong?

    Thanks
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: VBA macto to filter by last workday

    Maybe this

    Please Login or Register  to view this content.
    Kind regards
    Leo
    Attached Files Attached Files

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA macto to filter by last workday

    Try this.
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-09-2014
    Location
    Lisbon
    MS-Off Ver
    Microsoft Office 365 ProPlus Version 1708 (build 8431.2153)
    Posts
    62

    Re: VBA macto to filter by last workday

    Hi all,
    Thank you LeoTaxi. It works perfectly!
    Cheers!

+ 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] Macto to copy data untill last used column
    By dobracik in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-20-2015, 02:12 AM
  2. Replies: 1
    Last Post: 07-21-2014, 07:03 AM
  3. Macto to copy words from text file to excel
    By maor.wn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2013, 02:51 AM
  4. [SOLVED] Macto to insert page brake after multiple range in excel
    By visha_1984 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-25-2013, 06:06 AM
  5. Workday.INTL or Workday function issue
    By junoon in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-17-2013, 03:14 PM
  6. Workday Help
    By mhart210 in forum Excel General
    Replies: 3
    Last Post: 07-10-2006, 10:20 AM
  7. Workday and out by 1 bug
    By Skypilot in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-15-2005, 07:52 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