+ Reply to Thread
Results 1 to 9 of 9

Additional Help With AutoFilter VBA Coding

  1. #1
    Registered User
    Join Date
    10-16-2013
    Location
    KC, Kansas
    MS-Off Ver
    Office 365
    Posts
    18

    Additional Help With AutoFilter VBA Coding

    With the help of others in this forum, I've almost completed my coding project.

    I have a list in column "B" which includes:

    Pending (Responded)
    Assigned
    Closed - No Action Needed
    Available

    When I run the loop portion of this sub, I get the following string result:

    str = "Pending (Responded)", "Assigned", "Closed - No Action Needed", "Available"

    Now I need help using this string for the Criteria1 part of the AutoFilter method

    When I use this: str = Array(res), I get the Type mismatch error
    When I use this: str = "Array(" & res & ")", it doesn't filter anything and hides all the rows.

    Any help is appreciated
    Please Login or Register  to view this content.

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

    Re: Additional Help With AutoFilter VBA Coding

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    10-16-2013
    Location
    KC, Kansas
    MS-Off Ver
    Office 365
    Posts
    18

    Re: Additional Help With AutoFilter VBA Coding

    AlphaFrog - when I use your coding, I get a type mismatch error for "arr". Even when I try to print (using immediate window or debug.print) that string, I get the error.

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

    Re: Additional Help With AutoFilter VBA Coding

    The variable arr is not a string. It is an array of strings which is what you want for the autofilter. You cannot Debug.Print an array.

    This will loop through the array and Debug.Print each element.

    Please Login or Register  to view this content.
    Not sure why you're getting the error with the autofilter. Did you change anything at all in the code?

  5. #5
    Registered User
    Join Date
    10-16-2013
    Location
    KC, Kansas
    MS-Off Ver
    Office 365
    Posts
    18

    Re: Additional Help With AutoFilter VBA Coding

    Your last code doesn't filter anything, it just hides all the rows.

    Attached is a sample file.

    your coding is in Module 3, Try_This3
    Attached Files Attached Files

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

    Re: Additional Help With AutoFilter VBA Coding

    Your description in post #1 doesn't match the reality of your example workbook. I don't know what to want to filter.

    Quote Originally Posted by kstoneman View Post
    I have a list in column "B" which includes:

    Pending (Responded)
    Assigned
    Closed - No Action Needed
    Available
    Neither of the two sheets in your example workbook has that list in column B

    The code gets the list form "Control_Info" column B which doesn't have any of the above values. It then filters Working_Data column F (Field:=6) for the values from the list. None of those list values match column F.

  7. #7
    Registered User
    Join Date
    10-16-2013
    Location
    KC, Kansas
    MS-Off Ver
    Office 365
    Posts
    18

    Re: Additional Help With AutoFilter VBA Coding

    I uploaded the wrong file.

    Once I used the right file and columns of data, it works.

    I have another question - is there a way to clear the UsedRange without having to save/close the workbook?

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

    Re: Additional Help With AutoFilter VBA Coding

    You're welcome.

    Clear what used range? This will clear clear all the cells on Working_Data.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    10-16-2013
    Location
    KC, Kansas
    MS-Off Ver
    Office 365
    Posts
    18

    Re: Additional Help With AutoFilter VBA Coding

    The file I uploaded originally had 207K records, but I deleted all except 30K+. When I use Ctrl-End, it still includes all 207K records. I would like to have it only recognize the 30K records

+ 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] Modfication of Existing Code for additional additional cells
    By thilag in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-29-2016, 03:00 AM
  2. [SOLVED] In need of help regarding combo box coding and button coding (Access form project)
    By mailblade in forum Access Tables & Databases
    Replies: 2
    Last Post: 01-09-2016, 01:34 AM
  3. coding to autofilter,copy and paste that range
    By swfarm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-23-2014, 06:15 AM
  4. Replies: 1
    Last Post: 02-06-2014, 03:00 PM
  5. Would like to add an additional column into a search criteria - via amending coding
    By dillonsikorsky in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-28-2013, 12:51 PM
  6. [SOLVED] Vb macro coding for transpose - complete coding?
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-02-2013, 11:16 PM
  7. AutoFilter coding
    By Malvaro in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-27-2008, 02:52 PM

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