If you need to hide certain columns using a button, you can use this code. It will even change the command button text to Hide Columns and then again change it to Unhide Columns.
Dim C_ell As Range
If Selection.Characters.Text = "Unhide Columns" Then
Columns.Hidden = False
Selection.Characters.Text = "Hide Columns"
For Each C_ell In Range("B1", Cells(1, Columns.Count).End(xlToLeft))
If C_ell = "x" Then C_ell.Columns.Hidden = True
Selection.Characters.Text = "Unhide Columns"
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.