+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Valued Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    623

    Saving Customized Condition in List Box

    Hi all,

    Is there a way to save a (customized) condition from the list box?
    Everytime I want to check certain values, say for values >0, I would like to not have to set it up. I could then just select it from the dropdown list.

    Thanks,

    BDB

  2. #2
    Valued Forum Contributor MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    873

    Re: Saving Customized Condition in List Box

    Hi, You could use a select case, Example shown below to select a value in Col "C" based on you listbox selection.
    Code:
    Column(A)       
    ListBox List    
    Greater Than 0  
    Less Than 0     
    Equal to 0      
    Greater Than 10 
    Less Than 10    
    Equal to 10
    Code:
    Private Sub ListBox1_Click()
    Dim Rng As Range, Dn As Range, Con
    Set Rng = Range(Range("c1"), Range("c" & Rows.Count).End(xlUp))
        For Each Dn In Rng
            Select Case ListBox1.Value
                 Case Is = "Greater Than 0": If Dn > 0 Then Dn.Select: Exit Sub
                 Case Is = "Equal to 0": If Dn = 0 Then Dn.Select: Exit Sub
                 Case Is = "Greater Than 10": If Dn > 10 Then Dn.Select: Exit Sub
                 Case Is = "Less Than 10": If Dn < 10 Then Dn.Select: Exit Sub
                 Case Is = "Equal to 10": If Dn = 10 Then Dn.Select: Exit Sub
           End Select
        Next Dn
    End Sub
    Regards Mick
    Last edited by MickG; 07-02-2009 at 09:32 AM.

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.2.0