Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dropdown list determined by another dropdown list Wackyracer Excel Discussion (Misc queries) 5 April 27th 09 10:49 PM
Excell Dropdown List. Display alternate text than found in list. Shawnn Excel Discussion (Misc queries) 14 December 11th 08 07:43 PM
Dropdown List - list item endings not visible if column too narrow AK9955 Excel Discussion (Misc queries) 2 April 27th 07 09:02 AM
result of selecting from the dropdown list should be a dropdown list No News Excel Worksheet Functions 0 July 5th 06 04:09 PM
result of selecting from the dropdown list should be a dropdown list No News Excel Worksheet Functions 2 July 1st 06 10:53 AM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"