VBA Filtering Help

TheBeesKnees

New Member
Joined
Jul 5, 2011
Messages
1
Hey, I have been trying to write some code (very unsuccessfully) to do something like this and I was hoping to get some help. I almost never use VBA or really any sort of coding so I don't have much to go on (although I do use excel a bunch).

What I am trying to do is basically a filter for merged cells. I have merged cells which I want to be able to filter by and return all of the rows the merged cell includes (instead of just to first row of the cell that is the name of the merged cell). I know that the autofilter does not deal with merged cells well but for the most part I need to keep my merged cells merged instead of whiting out text or something like that in other cells.

The basic part of the sheet I am talking about is one column that has a header and then merged cells (of varying size) under it. So these merged cells span multiple rows (one column) and then gets the name of just the first cell. So my merged cell that spans A8:A40 just gets the name A8.

The autofilter would hide everything except for the A8 cell row (in the example cell above, since A8 gets the text while the other cells get blanks), while I want to have rows 8-40 still show up while everything else is hid.

So what I was thinking was to have a drop down list that would allow me to select the text in this cell (or any cell in the column). Then I would have the VBA code hide everything else except for the cell that matches the text in the drop down cell (so this is basically what the autofilter does, so I could use that for this step if there is no better way), and then I would need to do some sort of command that unhides the blank cells between the merged cell text and the next text string in the column. This should give me all of the rows I want to see since the cells that don't get the text in the merged cell are just blanks so unhiding by blanks until I see the next text should do the trick.

Problem is that I have almost no programming skills to actually do this and would love some guidance (I have been googling and searching for commands that could help me before I gave in and posted here). I hope I explained what I was trying to do ok, let me know if it was confusing or my logic here was flawed.

Thanks!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,224,527
Messages
6,179,331
Members
452,907
Latest member
Roland Deschain

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