+ Reply to Thread
Results 1 to 7 of 7

VBA -searching using range of values

  1. #1
    Registered User
    Join Date
    10-07-2008
    Location
    Singapore
    Posts
    11

    Question VBA -searching using range of values

    Hi i will appreciate any help rendered!

    scenario:
    I have a value X in cell B5 and a Value Y in cell B6, in multiple worksheets
    In my userform, i have 2 comboboxes
    one holding value ranges for the x coordinaate (eg 0-10, 11-20,21-30)
    the other holding values for the y coordinate (eg 0-10, 11-20,21-30)

    i want the user to be able to select a range from the x coordinate and the y coordinate...then i want to search thru all the B5 n B6 cels across the worksheets and return those worksheets that match the users input...

    is it possible for this to be done?
    Last edited by ACOM; 05-16-2009 at 03:59 PM.

  2. #2
    Registered User
    Join Date
    05-15-2009
    Location
    Mesa, AZ
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: VBA -searching using range of values

    It looks to me like you are looking for something like this:

    Please Login or Register  to view this content.
    - Leto2
    Excel

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: VBA -searching using range of values

    Maybe like this:
    Please Login or Register  to view this content.
    It doesn't have any error checking ...
    Last edited by shg; 05-15-2009 at 08:18 PM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    10-07-2008
    Location
    Singapore
    Posts
    11

    Re: VBA -searching using range of values

    Hi...the help is greatly appreciated...

    i m sorry but a lil confused now...
    shg-could u please explain what the code is doing?

    dxMin = CDbl(Left(sX, InStr(sX, "-") - 1))
    dxMax = CDbl(Mid(sX, InStr(sX, "-") + 1))


    i undertand that u defined the value ranges for x n y...]but i dont undestand the CDbl n left n mid thingy..]also how do i get the code to read the users selection from the combobox values?eg if user selects 0-10 from combobox 1 for x value and 20-30 for y value from combobox2 how do i use his input n do the search?

    thank u sooo much in advance

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: VBA -searching using range of values

    hg-could u please explain what the code is doing?
    It extracts the portions of the string before and after the hyphen and converts each to a Double.
    also how do i get the code to read the users selection from the combobox values?
    You don't. You pass those as parameters.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-07-2008
    Location
    Singapore
    Posts
    11

    Talking Re: VBA -searching using range of values

    Thank u a gazillion! i finally understand...thank u for ur time, patience and expertise!
    have a great day

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: VBA -searching using range of values

    You're welcome. Would you please mark the thread as Solved? (See How To ... in the menu bar.)

+ 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