+ Reply to Thread
Results 1 to 5 of 5

Using Variables In Filter Params

  1. #1
    Registered User
    Join Date
    03-17-2017
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    38

    Using Variables In Filter Params

    I am attempting to filter my worksheet with VBA syntax and my d2 variable anytime I hover over it is always showing blank and the filter is not applieying appropriately. Is this the correct hyphenation & punctuation to do this?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Using Variables In Filter Params

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    03-17-2017
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    38

    Re: Using Variables In Filter Params

    If I leave in the CDBL(d1) I get a type mismatch error - if I remove the CDBL(d1) it does not filter correctly. It filters to nothing, like an error occurred.

    I have the variables declared as string
    Please Login or Register  to view this content.
    I also tried to convert the string to a date by using CDate(d1) but that filters nothing like an error
    Last edited by bobgodfrey; 03-23-2017 at 03:28 PM.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Using Variables In Filter Params

    If you use strings and not dates (not sure why you would do that, but, anyway), then you need to use

    CDbl(CDate(string))

    Please Login or Register  to view this content.
    If you simply want to enter your dates so they look like dates, then use

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 03-23-2017 at 03:44 PM.

  5. #5
    Registered User
    Join Date
    03-17-2017
    Location
    Illinois
    MS-Off Ver
    2013
    Posts
    38

    Re: Using Variables In Filter Params

    That did it, thank you

+ 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. Loop thru range params - external web connection
    By DavidLi2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2014, 04:21 AM
  2. Advanced Filter with 'OR' for 2 different variables
    By thedutchrudder in forum Excel General
    Replies: 2
    Last Post: 06-16-2014, 09:41 AM
  3. how to filter variables among two columns
    By fantombot83 in forum Excel General
    Replies: 1
    Last Post: 05-13-2013, 03:06 PM
  4. Replies: 1
    Last Post: 12-06-2010, 03:03 PM
  5. Replies: 0
    Last Post: 12-02-2005, 02:20 PM
  6. Programmatically pass query params
    By G in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-27-2005, 08:06 PM
  7. [SOLVED] Passing Params to Embedded query programmatically
    By G in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2005, 10:06 AM

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