+ Reply to Thread
Results 1 to 4 of 4

How can I unhide columns on multiple worksheets in same workbook?

  1. #1
    Carey N.
    Guest

    How can I unhide columns on multiple worksheets in same workbook?

    Keeping in mind that I know next to nothing about coding, the following is
    what appeared after using the macro recorder to unhide columns on multiple
    sheets in an Excel workbook.(Same thing has occurred in Excel 97 and Excel
    2002.)

    Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
    Sheets("Sheet1").Activate
    Columns("A:E").Select
    Selection.EntireColumn.Hidden = False

    After I re-hide the columns and tried to use the macro, only the columns on
    the first sheet were unhidden.

    Is there a shorter or more precise way to make this work on all three sheets
    from a macro, without having to select each individual sheet(and will it
    also work for re-hiding the columns), as below:

    Sheets("Sheet1").Activate
    Columns("A:E").Select
    Selection.EntireColumn.Hidden = False
    Sheets("Sheet2").Activate
    Columns("A:E").Select
    Selection.EntireColumn.Hidden = False
    Sheets("Sheet3").Activate
    Columns("A:E").Select
    Selection.EntireColumn.Hidden = False

    Any help greatfully accepted.
    --
    Carey in MA



  2. #2
    Jim Thomlinson
    Guest

    RE: How can I unhide columns on multiple worksheets in same workbook?

    Sheets("Sheet1").Columns("A:E").EntireColumn.Hidden = False
    Sheets("Sheet2").Columns("A:E").EntireColumn.Hidden = False
    Sheets("Sheet3").Columns("A:E").EntireColumn.Hidden = False
    --
    HTH...

    Jim Thomlinson


    "Carey N." wrote:

    > Keeping in mind that I know next to nothing about coding, the following is
    > what appeared after using the macro recorder to unhide columns on multiple
    > sheets in an Excel workbook.(Same thing has occurred in Excel 97 and Excel
    > 2002.)
    >
    > Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
    > Sheets("Sheet1").Activate
    > Columns("A:E").Select
    > Selection.EntireColumn.Hidden = False
    >
    > After I re-hide the columns and tried to use the macro, only the columns on
    > the first sheet were unhidden.
    >
    > Is there a shorter or more precise way to make this work on all three sheets
    > from a macro, without having to select each individual sheet(and will it
    > also work for re-hiding the columns), as below:
    >
    > Sheets("Sheet1").Activate
    > Columns("A:E").Select
    > Selection.EntireColumn.Hidden = False
    > Sheets("Sheet2").Activate
    > Columns("A:E").Select
    > Selection.EntireColumn.Hidden = False
    > Sheets("Sheet3").Activate
    > Columns("A:E").Select
    > Selection.EntireColumn.Hidden = False
    >
    > Any help greatfully accepted.
    > --
    > Carey in MA
    >
    >
    >


  3. #3
    Carey N.
    Guest

    Re: How can I unhide columns on multiple worksheets in same workbook?

    Jim, many thanks for your response. I shall try that. It certainly looks
    much neater than what I was going to use.
    --
    Regards,
    Carey in MA


    "Jim Thomlinson" <[email protected]> wrote in message
    news:[email protected]...
    > Sheets("Sheet1").Columns("A:E").EntireColumn.Hidden = False
    > Sheets("Sheet2").Columns("A:E").EntireColumn.Hidden = False
    > Sheets("Sheet3").Columns("A:E").EntireColumn.Hidden = False
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "Carey N." wrote:
    >
    > > Keeping in mind that I know next to nothing about coding, the following

    is
    > > what appeared after using the macro recorder to unhide columns on

    multiple
    > > sheets in an Excel workbook.(Same thing has occurred in Excel 97 and

    Excel
    > > 2002.)
    > >
    > > Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
    > > Sheets("Sheet1").Activate
    > > Columns("A:E").Select
    > > Selection.EntireColumn.Hidden = False
    > >
    > > After I re-hide the columns and tried to use the macro, only the columns

    on
    > > the first sheet were unhidden.
    > >
    > > Is there a shorter or more precise way to make this work on all three

    sheets
    > > from a macro, without having to select each individual sheet(and will it
    > > also work for re-hiding the columns), as below:
    > >
    > > Sheets("Sheet1").Activate
    > > Columns("A:E").Select
    > > Selection.EntireColumn.Hidden = False
    > > Sheets("Sheet2").Activate
    > > Columns("A:E").Select
    > > Selection.EntireColumn.Hidden = False
    > > Sheets("Sheet3").Activate
    > > Columns("A:E").Select
    > > Selection.EntireColumn.Hidden = False
    > >
    > > Any help greatfully accepted.
    > > --
    > > Carey in MA
    > >
    > >
    > >




  4. #4
    NickHK
    Guest

    Re: How can I unhide columns on multiple worksheets in same workbook?

    Carey,
    If you want a more flexible way:

    Dim WS As Worksheet
    Const SheetsToWorkOn As String = "Sheet2,Sheet3"

    'For Each WS In Worksheets(Array("Sheet2", "Sheet3"))
    'Or
    For Each WS In Worksheets(Split(SheetsToWorkOn, ","))
    WS.Columns("A:E").EntireColumn.Hidden = False
    Next

    NickHK

    "Carey N." <[email protected]> wrote in message
    news:n_qEg.20498$yE1.5567@trndny02...
    > Keeping in mind that I know next to nothing about coding, the following is
    > what appeared after using the macro recorder to unhide columns on multiple
    > sheets in an Excel workbook.(Same thing has occurred in Excel 97 and Excel
    > 2002.)
    >
    > Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
    > Sheets("Sheet1").Activate
    > Columns("A:E").Select
    > Selection.EntireColumn.Hidden = False
    >
    > After I re-hide the columns and tried to use the macro, only the columns

    on
    > the first sheet were unhidden.
    >
    > Is there a shorter or more precise way to make this work on all three

    sheets
    > from a macro, without having to select each individual sheet(and will it
    > also work for re-hiding the columns), as below:
    >
    > Sheets("Sheet1").Activate
    > Columns("A:E").Select
    > Selection.EntireColumn.Hidden = False
    > Sheets("Sheet2").Activate
    > Columns("A:E").Select
    > Selection.EntireColumn.Hidden = False
    > Sheets("Sheet3").Activate
    > Columns("A:E").Select
    > Selection.EntireColumn.Hidden = False
    >
    > Any help greatfully accepted.
    > --
    > Carey in MA
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1