Filtering Excel Data with VBA

mosslovell

New Member
Joined
Oct 5, 2014
Messages
4
Hi All,

I have been searching the internet to solve my little problem.

I have some data and I would like to filter in place unique data to show unique values only.

I dont want to copy the data to another sheet as i will be using the filtered data to filter it down some more.

So for example

[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl63, width: 64"]Name[/TD]
[TD="class: xl63, width: 64"]Last[/TD]
[TD="class: xl63, width: 64"]Place[/TD]
[/TR]
[TR]
[TD="class: xl63, width: 64"]Ann[/TD]
[TD="class: xl63, width: 64"]A[/TD]
[TD="class: xl63, width: 64"]Wolves[/TD]
[/TR]
[TR]
[TD="class: xl63, width: 64"]Ann[/TD]
[TD="class: xl63, width: 64"]b[/TD]
[TD="class: xl63, width: 64"]Bham[/TD]
[/TR]
[TR]
[TD="class: xl63, width: 64"]Betty[/TD]
[TD="class: xl63, width: 64"]a[/TD]
[TD="class: xl63, width: 64"]Wolves[/TD]
[/TR]
[TR]
[TD="class: xl63, width: 64"]Carol[/TD]
[TD="class: xl63, width: 64"]a[/TD]
[TD="class: xl63, width: 64"]Bham[/TD]
[/TR]
[TR]
[TD="class: xl63, width: 64"]Carol[/TD]
[TD="class: xl63, width: 64"]b[/TD]
[TD="class: xl63, width: 64"]Wolves[/TD]
[/TR]
[TR]
[TD="class: xl63, width: 64"]Ann[/TD]
[TD="class: xl63, width: 64"]A[/TD]
[TD="class: xl63, width: 64"]Wolves[/TD]
[/TR]
[TR]
[TD="class: xl64, width: 64"]Carol[/TD]
[TD="class: xl64, width: 64"]a[/TD]
[TD="class: xl64, width: 64"]Bham[/TD]
[/TR]
</tbody>[/TABLE]
So I need to filter on Wolves and show only the unique names.

Thanks in advance guys.

Moss
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
If you research advanced filters, I think those will manage what you are looking for. In your example though, you would have to enter "Place" and "Wolves" into 2 cells of your sheet first, then use that for the criteria range argument of the advanced filter. I would try out the advanced filter through the Ribbon GUI first to see how it works before messing with the VBA.
 
Upvote 0
If you research advanced filters, I think those will manage what you are looking for. In your example though, you would have to enter "Place" and "Wolves" into 2 cells of your sheet first, then use that for the criteria range argument of the advanced filter. I would try out the advanced filter through the Ribbon GUI first to see how it works before messing with the VBA.

Thanks for your reply Odin.

I think you have misunderstood me.

When you do an advanced filter you can have the results displayed on the same page(inplace) which only shows the results or have the results copied to another sheet.

I have tried mixing normal filter and advanced filter but some object error shows.

The data also has other columns, which I guess play a part in the rows being unique or not.

So i need to filter data based on the selection then show only the unique values where the values to use are in the first 3 columns only.

Cheers all that have the knowledge.

Moss
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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
Back
Top