Macro for Show/Hide Column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I am trying to write a Macro to Toggle Show/Hide column D

Anybody able to help?

with thanks...Andy
 
Here's a basic macro that will do it:

Sub HideColD()
Columns("D:D").Select
If Selection.EntireColumn.Hidden = False Then
Selection.EntireColumn.Hidden = True
Else
Selection.EntireColumn.Hidden = False
End If
Range("D1").Select
End Sub


tj
 
Simpler

With Columns("D:D")
.Hidden = Not .Hidden
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
or

Sub togglehide()
columns("d").Entirecolumn.Hidden = True = Not _
columns("d").Entirecolumn.Hidden = True
End Sub
 
worked well. chose this one.

tjtjjtjt said:
Here's a basic macro that will do it:

Sub HideColD()
Columns("D:D").Select
If Selection.EntireColumn.Hidden = False Then
Selection.EntireColumn.Hidden = True
Else
Selection.EntireColumn.Hidden = False
End If
Range("D1").Select
End Sub


tj
 

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.

Ask a Question

Back
Top