+ Reply to Thread
Results 1 to 13 of 13

For Next Statement: Hiding Columns on Successive Sheets not Working

  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.

    Please Login or Register  to view this content.
    Last edited by mandora; 11-06-2013 at 02:34 PM.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    I think it is actually the .Select line that is messing you up. Remove it and try

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    Sigh, double post

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    Maybe:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

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

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    Thank you for replies. Unfortunately neither suggestion worked singly or together.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    Can you post a sample file with your entire code included so we can see what's not happening. I'm curious as too what your Select statement is doing. To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

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

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    Attached is requested file. This is a work in progress. For example, formulas in Variance sheet need some work and the selection of accounts, other than the first item, in the GOTO ACCOUNTS combobox should deactive or hide the filter button. The purpose of the workbook is to make it very easy to zero in on selected accounts in selected programs (with other programs hidden) on any sheet though the CASE selections. For purposes of this demo, I have eliminated all but the first case statement for programs. Press 'SHOW ALL' to unhide all columns/rows on all sheets. Select 'Administration' in SELECT PROGRAM combobox to test the case statement referenced in this post. Thank you.

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

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    I have tried various coding between the Select Case and End Select for Case Is = "NumberOne". All throw error messages. Any ideas on correct coding?

    Please Login or Register  to view this content.

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    If it's not solved by tomorrow - I'll try my hand at it.

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

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    That would be appreciated, xladept.

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    Hi Mandora,

    This code may work for you:

    Please Login or Register  to view this content.
    The sheets were protected.

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

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    xladept, your response is exemplary! The first set of code works. Hurray! I will try the others later. The thoroughness of your response will give me a boost in understanding how to approach similar coding in the future. You get a star!! - mandora

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: For Next Statement: Hiding Columns on Successive Sheets not Working

    You're welcome!

    BTW don't forget to re-protect the sheets.

+ Reply to Thread

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