You didn't mention excel version so this should work with all
Sub hidecolumns()
Dim lc As Long
With ActiveSheet
lc = Cells(1, "d").End(xlToRight).Column
.Columns.Hidden = False
.Columns(5).Resize(, lc - 4).Hidden = True
End With
End Sub
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.