My problem:
I have a spreadsheet with ids and names to search.
I thought I could use the filter option but the ids or names are in merged cells, so the filter option only returns the first row of data about an id or name.
My spread sheet:
|Header 1| header 2| header 3| header 4|
|--------------------------------------|
| | | data1 | data1 |
|id1 | name1 | data2 | data2 |
| | | data3 | data3 |
|--------------------------------------|
| | | data1 | data1 |
|id2 | name2 | data2 | data2 |
| | | data3 | data3 |
|--------------------------------------|
What I've looked into:
How to sort/filter merged cells in Excel?
Here I learned I would get all the data by unmerging the cells and giving them the same values. But there are a few problems:
This needs to be foolproof. It would be easy for a user to give them diferent names or ids by mistake
The names are often long, so merging the cells allows me to display them completely without column B being too wide
I have already written code to write and read this data, I would need to review how I navigate the spreadsheets
How do I avoid merging cells vertically in excel?
This post suggested replacing the merged cell by a textbox on top of the cells, this could work if I had a formula to give each cell under the textbox the value in the textbox automatically. But again, not super foolproof or clean.
The solution?
I don't actually want to filter data. I want the user to get to the right part of the sheet by using a searchbox.
I was thinking a macro could work this way:
Listen for the user to apply a filter on a specific sheet, specific header
Store the address of the first visible cell under the header in variable MyCell
Remove the filter
Select MyCell
Is this possible?
Alternative solution?
Listen for the user to apply a filter on a specific sheet, specific header
Make the 2 rows under each filtered row visible
Could also work but not necessary.
Range.Find
to bring them to the spot. There are several other ways too, if this isn't a serviceable solution. – Kyle