+ Reply to Thread
Results 1 to 4 of 4

Hiding and un hiding columns using VBA code

  1. #1
    Registered User
    Join Date
    02-27-2014
    Location
    Nairobi, Kenya
    MS-Off Ver
    Excel 2010
    Posts
    7

    Hiding and un hiding columns using VBA code

    Hi

    I'm really trying to get in the swing of this VBA thing but I think I'm starting in the middle rather than at the beginning so making some simple errors. I've only just started using google to find the things I want to do an adapting it so I don't have any training yet but i'll get there.

    I need a code that will allow a button to unhide a set of columns when pushed with a password and then hide again.

    I have come up with this

    Please Login or Register  to view this content.
    At first it was working OK - you could enter the correct password and it would unhide the columns and change the button name. However, if you entered the password wrong it disables the button permanently (instead of just closing the message box and not unhiding the columns). You also need to enter the password to hide the columns which is not needed.

    Maybe I need two buttons but it would be quite nice to just have the one!!!

    However, something in my table has changed - I removed the total row and added a new Sub to automatically enter a date when a booking was made. Now I get the error "Unable to set the hidden property of the range class"

    Any help would be appreciated for this VBA total novice :-)


    Many thanks

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Hiding and un hiding columns using VBA code

    Please Login or Register  to view this content.
    If you have any merged cells in columns P:Y, that may cause the "Unable to set..." error
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    08-01-2012
    Location
    Montreal, Qc, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Hiding and un hiding columns using VBA code

    Alphafrog`s code is more complete then the following,

    but since its done, ill post it any ways


    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-27-2014
    Location
    Nairobi, Kenya
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Hiding and un hiding columns using VBA code

    This works perfectly

    Thanks so much for taking the time to help!

    Jes

+ 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. [SOLVED] Changes & creation of Code for hiding & unhiding columns & Sheet
    By paradise2sr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2013, 09:14 AM
  2. Hiding columns in excel without hiding form button
    By rename in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-01-2013, 01:38 AM
  3. Replies: 9
    Last Post: 09-19-2012, 05:31 AM
  4. Problem hiding columns of a sheet with code that is operative in other sheets
    By RagonichaFulva in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2011, 04:56 AM
  5. Un-Hiding and Hiding Columns based on Drop-Down Values in a Column.
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 10-30-2011, 09:24 AM
  6. Un-Hiding and Hiding Columns based on Drop-Down Values in a Column.
    By e4excel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2011, 06:49 AM
  7. VBA code for hiding columns based on cell value
    By Aramis06 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2010, 01:21 PM
  8. Replies: 2
    Last Post: 10-18-2005, 10:05 PM

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