Results 1 to 13 of 13

For Next Statement: Hiding Columns on Successive Sheets not Working

Threaded View

  1. #1
    Registered User
    Join Date
    12-02-2012
    Location
    Silver Bay, MN
    MS-Off Ver
    Excel 2010
    Posts
    47

    For Next Statement: Hiding Columns on Successive Sheets not Working

    This code is activated from a combobox selection on sheet1 and is supposed to hide designated columns on sheets1-3. It works fine on sheet1 but gives "cannot set hidden property" message when it attempts to process sheet2. I have tried a number of ways to qualify this code but can't make it work. Help would be greatly appreciated.

    Dim sh As Long
            Case Is = "NumberOne"
                
                For sh = 1 To 3  'Sheets 1-3
                    ThisWorkbook.Worksheets(sh).Columns("F:X").EntireColumn.Hidden = False  'Unhides all columns in range
                    ThisWorkbook.Worksheets(sh).Columns("G:X").EntireColumn.Hidden = True  'Hides all columns except column F
                    ThisWorkbook.Worksheets(sh).Range("F2").Select  'Locates cursor on sheet
                Next
    Last edited by mandora; 11-06-2013 at 02:34 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Max If statement not working across multiple sheets
    By Robmeister89 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-26-2013, 08:49 AM
  2. Hiding particular columns on multiple sheets
    By ge3kspeak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2012, 01:02 PM
  3. Change range name location for successive sheets
    By davter in forum Excel General
    Replies: 2
    Last Post: 01-02-2012, 01:15 PM
  4. Procedure for hiding all but certain sheets.......not working
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2011, 11:00 AM
  5. Replies: 11
    Last Post: 09-26-2011, 11:29 AM

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