+ Reply to Thread
Results 1 to 5 of 5

applying changes to multiple selected worksheets

Hybrid View

  1. #1
    Registered User
    Join Date
    11-13-2003
    Location
    California
    MS-Off Ver
    2013
    Posts
    37

    Question applying changes to multiple selected worksheets

    All,

    I have code which currently selects all but the 1st of my worksheets and now I'd like to make all selected worksheets = very hidden but can't figure out the last piece of syntax.

    A little help will be most appreciated!

    Dim ws As Worksheet
     Application.ScreenUpdating = False
      Sheets(2).Select
     For Each ws In ActiveWorkbook.Sheets
      If ws.Index <> 1 Then ws.Select False
     Next ws
     Application.ScreenUpdating = True
     
     'ActiveWorkbook.Sheets.Visible = xlVeryHidden
     'ActiveWorkbook.Sheets.Select = xlVeryHidden
     'ActiveWindow.SelectedSheets = xlVeryHidden

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Sub Macro7()
    Dim ws As Worksheet
    Application.ScreenUpdating = False
    For Each ws In ActiveWorkbook.Sheets
    If ws.Index <> 1 Then ws.Visible = xlVeryHidden
    Next ws
    Application.ScreenUpdating = True
    End Sub
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    11-13-2003
    Location
    California
    MS-Off Ver
    2013
    Posts
    37
    Thanks!

    I see you changed/added quite a bit from what I had originally but I just changed:

    If ws.Index <> 1 Then ws.Select False
    to
    If ws.Index <> 1 Then ws.Visible = xlVeryHidden
    and kept everything else the same and it works perfectly.

    Except now I don't understand why it's not selecting the 1st tab, oh well as long as it works I suppose.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Change

    Sheets(2).Select
    to

    Sheets(1).Select
    VBA Noob

  5. #5
    Registered User
    Join Date
    11-13-2003
    Location
    California
    MS-Off Ver
    2013
    Posts
    37
    Funny... I get the same result using 1 or 2 but get an error using anything else

+ 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