So I currently have a userform setup to hide a bunch of columns, and then buttons to reveal sets of columns as I want to look at them. It works fine, here is a snippet of my code for reference:
So the super obvious issue with this is if any columns are added or deleted from the sheet, it ruins all my filters immediately and I have to spend ages adjusting them in VBA. What I would like to do is set up a helper row that I can tag with an indentifier (E.G, for my photography filter I could have "PH01"), and instead of having the code hide a specific column based on my input directly in the code, have it check the helper cell and hide based on the ID tag.
Code:
Private Sub UserForm_Initialize()
Columns.EntireColumn.Hidden = False
Rows.EntireRow.Hidden = False
ActiveWindow.FreezePanes = False
Rows("5").Hidden = True
Columns("A:C").Hidden = True
Columns("E:J").Hidden = True
Columns("L:BH").Hidden = True
Columns("AT:BG").Hidden = True
Columns("BJ").Hidden = True
End Sub
Code:
Private Sub Photography_Filter_Click()
Columns("AB:AC").Hidden = False
Columns("BG").Hidden = False
So the super obvious issue with this is if any columns are added or deleted from the sheet, it ruins all my filters immediately and I have to spend ages adjusting them in VBA. What I would like to do is set up a helper row that I can tag with an indentifier (E.G, for my photography filter I could have "PH01"), and instead of having the code hide a specific column based on my input directly in the code, have it check the helper cell and hide based on the ID tag.