+ Reply to Thread
Results 1 to 8 of 8

Hide Multiple Columns by Command Button

  1. #1
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Hide Multiple Columns by Command Button

    Hi everyone,

    Can anyone help me with this problem

    I have a monitoring file for reinforcing bars (please see attached file)

    I am monitoring the request, delivery and balances. what i want to achieve is to make an active control button that hides columns

    for instance, there are multiple request, so instead of scrolling to the right, i will just click the buttons so that my views are compressed.

    i'd be glad if someone can help.

    VBA needed.xlsm

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Hide Multiple Columns by Command Button

    Here you go, I did the code for "Hide Weight" button, it should be fairly straightforward how to adjust this for your other buttons. You'll need one Sub per button.

    Please note that the name of the sub ( the "Hide_Weight" part), needs to match the name of your button (Developer Mode > Right Click .Properties > Name field)

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Hide Multiple Columns by Command Button

    that was fast

    Thank you soo much @walruseggman

    just one last thing.

    I will add a dropdown menu that will show the request number

    VBA needed (updated).xlsm

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Hide Multiple Columns by Command Button

    I was surprised that VBA won't allow hiding a range of columns by column number. That is, I couldn't get Columns("6:" c.Column -1) to work. Oh well, this code should work fine.

    Again, make sure your button name matches the Sub name.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Hide Multiple Columns by Command Button

    walruseggman,

    is there a way that only the chosen item on drop down list will be shown?

    because when i chose 0001, items 0001, 0002 and 0003 are shown, but when i chose 0002, only item 0001 is hidden..

    is it possible to show only 0002 when i chose 0002 and not 0002 and everything that follows?

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Hide Multiple Columns by Command Button

    I recommend adding an "All" value to your dropdown so that you can show all the requests again after showing just one. I've accounted for that in the code.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2013
    Posts
    66

    Re: Hide Multiple Columns by Command Button

    one again @walruseggman, thank you sooo much..

    that's cool

  8. #8
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Hide Multiple Columns by Command Button

    You're welcome! Don't forget to mark this thread as solved, and any reputation points (the * in the lower left of my posts) is appreciated.

+ 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. Hide/Unhide Multiple Sets of Columns with Toggle Button
    By Mischief433 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-06-2012, 05:55 AM
  2. Hide/Unhide Command Button based on multiple cell values
    By dagindi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-05-2011, 09:03 PM
  3. Hide command button behind pic
    By ABabeNChrist in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-16-2010, 12:16 AM
  4. command button on/off (show/hide)
    By gobbolino in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2007, 10:35 PM
  5. Hide command button
    By MarcoR in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2006, 12:35 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