Advanced filter on multiple column

ceslyn

New Member
Joined
Mar 4, 2009
Messages
48
I've been looking over the net for information about filtering information in excel vba and haven't managed to find nothing that works.

My header is in row 22 with all the title
I have 23 columns wide of information starting at A23
I want to be able to choose my selection in column C5:C20 (each line is related to a title in my header row and these are all exact match) and this will filter my information when I press the button.

I've tried multiple ways and can make the auto filter work.

Unfortunately I am starting from scratch and need help. I'm sure this is a very simple task for someone that has knowledge with VBA.

Thanks in advance for your help.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

ceslyn

New Member
Joined
Mar 4, 2009
Messages
48
I've managed to work with this code but it doesn't work properly.

Private Sub CommandButton3_Click()
Dim item As String
Dim rng As Range
item = Sheet1.Range("d1").Value

Set rng = Sheet1.Range("a23")
rng.AutoFilter Field:=1, Criteria1:=item
Sheet1.Select
End Sub

I keep on loosing my rows from 23 to 294 but i do get the rest to 24000.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,601
Messages
5,838,284
Members
430,536
Latest member
Manoj Gaidhankar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top