hide columns

orsm6

Well-known Member
Joined
Oct 3, 2012
Messages
515
Office Version
  1. 365
Platform
  1. Windows
hi all

I haven't found anything yet that can help me do what i need. Hoping someone may have the answer.

I have B11 setup with a drop down list of peoples names.
In range D11:IS11 are those same names.

i would like a macro that searches D11:IS11 for the name in B11 and if it is found, hide all other columns.

preference would be that the macro runs from clicking a 'search' button, not by worksheet change event

TIA
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Here is the code you need to attach to a button

Code:
Option Explicit


Sub HideB11()
    Dim i As Long
    Application.ScreenUpdating = False
    For i = 4 To 253
        If Cells(11, i) <> Range("B11") Then
            Cells(11, i).EntireColumn.Hidden = True
        End If
    Next i
    Application.ScreenUpdating = True


End Sub
 
Upvote 0
that is spot on, i appreciate your fast reply.

thank you very much
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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