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!
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!