Excel VBA Hiding a Column - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Excel VBA Hiding a Column

rrfullirrfulli Posts: 1Member
I am looking for a method to hide a selected column using VBA in excel. To select a column I:

Worksheets("Sheet1").Columns(1).Select

That's as far as I get. The column is now selected. How do I hide the selected column??????

Thanks
Ranny

Comments

  • markycmarkyc Posts: 11Member
    Hey Ranny,

    With any kind of simple task you can use the macro recorder in order to automatically generate the code for you:
    ie:

    Columns("I:I").Select
    Selection.EntireColumn.Hidden = True

    In general you just set the EntireColumn.Hidden property to True or False to hide/unhide a particular column.
    Columns("I:I").EntireColumn.Hidden = True

    Ciao,
    Mark


    : I am looking for a method to hide a selected column using VBA in excel. To select a column I:
    :
    : Worksheets("Sheet1").Columns(1).Select
    :
    : That's as far as I get. The column is now selected. How do I hide the selected column??????
    :
    : Thanks
    : Ranny
    :

Sign In or Register to comment.