+ Reply to Thread
Results 1 to 6 of 6

Advanced filter from closed workbook

  1. #1
    Registered User
    Join Date
    08-30-2016
    Location
    NYC
    MS-Off Ver
    2013
    Posts
    3

    Unhappy Advanced filter from closed workbook

    Hi,

    I am trying to pull data from a closed workbook using advanced filter.

    here is what my code looks like right now. It works fine if I have both the workbook with the criteria as well as the workbook "ORDERS CHART" open

    Please Login or Register  to view this content.
    However, if "ORDERS CHART" is closed, I get the following error:

    Run-time error '1004':
    Method 'Range' of object'_Global' failed
    Any help would be greatly appreciated! I have been stuck for days!

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Advanced filter from closed workbook

    Most likely, you can't get the information from the closed workbook.
    You can open and close the workbook in the same code.

  3. #3
    Registered User
    Join Date
    08-30-2016
    Location
    NYC
    MS-Off Ver
    2013
    Posts
    3

    Re: Advanced filter from closed workbook

    Quote Originally Posted by davesexcel View Post
    Most likely, you can't get the information from the closed workbook.
    You can open and close the workbook in the same code.
    Could you help me incorporate that "open and close workbook" statement in my code?

    Thanks a lot for the quick response, I really appreciate it!

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Advanced filter from closed workbook

    Just like you used your macro recorder for the original code, you can use the macro recorder to open the workbook, do your advanced filter, then close the workbook.

    Post back with the code if you need help editing it.

  5. #5
    Registered User
    Join Date
    08-30-2016
    Location
    NYC
    MS-Off Ver
    2013
    Posts
    3

    Re: Advanced filter from closed workbook

    Quote Originally Posted by davesexcel View Post
    Just like you used your macro recorder for the original code, you can use the macro recorder to open the workbook, do your advanced filter, then close the workbook.

    Post back with the code if you need help editing it.
    Here is the code I have with the macro recorder:

    Please Login or Register  to view this content.
    I get the following error:
    Run-time error '9'
    Subscript out of range

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,474

    Re: Advanced filter from closed workbook

    It seems that you missed the part about opening the workbook in the code.

+ 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. Replies: 0
    Last Post: 03-27-2014, 12:38 PM
  2. [SOLVED] Macro To Perform same Advanced Filter on Different Worksheets in Workbook
    By PWinkz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-18-2013, 12:43 PM
  3. Replies: 1
    Last Post: 09-18-2013, 10:01 AM
  4. [SOLVED] Copying data from a closed workbook into an open workbook ignoring excel filter?
    By reach78 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 09-17-2013, 12:31 AM
  5. Replies: 5
    Last Post: 09-13-2013, 12:03 AM
  6. advanced filter - button to re apply advanced filter across multiple sheets
    By motmac87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2013, 11:16 PM
  7. [SOLVED] advanced filter a range:Advanced Filter function
    By Il Principe in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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