hide columns

orsm6

Active Member
Joined
Oct 3, 2012
Messages
496
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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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,213,551
Messages
6,114,267
Members
448,558
Latest member
aivin

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