Experts Exchange connects you with the people and services you need so you can get back to work.
Improve company productivity with a Business Account.Sign Up
Dim LastC As Long
Dim Counter As Long
Application.ScreenUpdating = False
LastC = .Cells(1, .Columns.Count).End(xlToLeft).Column
.Range(.Cells(1, LastC + 1), .Cells(1, .Columns.Count)).EntireColumn.Hidden = True
For Counter = 1 To LastC
'if you meant "hide where cell <> 1" then use:
.Cells(1, Counter).EntireColumn.Hidden = (.Cells(1, Counter) <> 1)
' if you meant "hide where cell does not contain 1" then use:
'.Cells(1, Counter).EntireColumn.Hidden = (Not .Cells(1, Counter) Like "*1*")
Application.ScreenUpdating = True
Open in new window
The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.