Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
autofiltering using a dropdown list
Hi,
I am stuck on this problem, hopefully someone can help me. Basically what I've got is a dropdown list of 3 options - A,B and C with a linking cell which shows 1 if A is selected, 2 for B and 3 for c. In the cell next (F2) to that I have a vlookup so that it shows what letter it corresponds to each time a new option is selected. On another sheet I have a list of As Bs and Cs which represent my records. What I am trying to do is when a letter is selected this list is autofiltered based on what the vlookup cell shows. The code I have is: Sub filter() If Worksheets("data").Range("E2").Value = "A" Then Worksheets("data records").AutoFilter Field:=1, Criteria1:=Range("F2") ElseIf Worksheets("data").Range("E2").Value = "2" Then Worksheets("data records").AutoFilter Field:=1, Criteria1:=Range("F2") Else Worksheets("data records").AutoFilter Field:=1, Criteria1:=Range("F2") End If End Sub The autofilter doesn't work. Can some tell me where I am goin wrong and what the best way is to go about doing this. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
autofiltering using a dropdown list
Gina Try Debra Dalgliesh's site www.contextures.com for excellent examples on filters Peter Atherton Hi, I am stuck on this problem, hopefully someone can help me. Basically what I've got is a dropdown list of 3 options - A,B and C with a linking cell which shows 1 if A is selected, 2 for B and 3 for c. In the cell next (F2) to that I have a vlookup so that it shows what letter it corresponds to each time a new option is selected. On another sheet I have a list of As Bs and Cs which represent my records. What I am trying to do is when a letter is selected this list is autofiltered based on what the vlookup cell shows. The code I have is: Sub filter() If Worksheets("data").Range("E2").Value = "A" Then Worksheets("data records").AutoFilter Field:=1, Criteria1:=Range("F2") ElseIf Worksheets("data").Range("E2").Value = "2" Then Worksheets("data records").AutoFilter Field:=1, Criteria1:=Range("F2") Else Worksheets("data records").AutoFilter Field:=1, Criteria1:=Range("F2") End If End Sub The autofilter doesn't work. Can some tell me where I am goin wrong and what the best way is to go about doing this. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
autofiltering using a dropdown list
Thanks for this Peter
"PeterAtherton" wrote: Gina Try Debra Dalgliesh's site www.contextures.com for excellent examples on filters Peter Atherton Hi, I am stuck on this problem, hopefully someone can help me. Basically what I've got is a dropdown list of 3 options - A,B and C with a linking cell which shows 1 if A is selected, 2 for B and 3 for c. In the cell next (F2) to that I have a vlookup so that it shows what letter it corresponds to each time a new option is selected. On another sheet I have a list of As Bs and Cs which represent my records. What I am trying to do is when a letter is selected this list is autofiltered based on what the vlookup cell shows. The code I have is: Sub filter() If Worksheets("data").Range("E2").Value = "A" Then Worksheets("data records").AutoFilter Field:=1, Criteria1:=Range("F2") ElseIf Worksheets("data").Range("E2").Value = "2" Then Worksheets("data records").AutoFilter Field:=1, Criteria1:=Range("F2") Else Worksheets("data records").AutoFilter Field:=1, Criteria1:=Range("F2") End If End Sub The autofilter doesn't work. Can some tell me where I am goin wrong and what the best way is to go about doing this. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
dropdown list determined by another dropdown list | Excel Discussion (Misc queries) | |||
Excell Dropdown List. Display alternate text than found in list. | Excel Discussion (Misc queries) | |||
Dropdown List - list item endings not visible if column too narrow | Excel Discussion (Misc queries) | |||
result of selecting from the dropdown list should be a dropdown list | Excel Worksheet Functions | |||
result of selecting from the dropdown list should be a dropdown list | Excel Worksheet Functions |