+ Reply to Thread
Results 1 to 10 of 10

hide columns if a cell has a specific word

  1. #1
    Forum Contributor
    Join Date
    03-20-2013
    Location
    London, England
    MS-Off Ver
    Excel 2011
    Posts
    474

    hide columns if a cell has a specific word

    Hello,

    I have a few "maps" in my sheet.
    instead of listing them all side by side, i thought it would be nice to have a drop down box which would then unhide the columns of the map selected thus showing 1 map at a time based on my selection.

    i dont know what the VBA is to achieve this.

    thanks
    Last edited by tlacloche; 02-17-2014 at 04:07 PM.

  2. #2
    Forum Contributor
    Join Date
    03-20-2013
    Location
    London, England
    MS-Off Ver
    Excel 2011
    Posts
    474

    Re: hide columns if a cell has a specific word

    this works with option buttons
    Please Login or Register  to view this content.
    i would use this code for every map.

    however, i dont know how to transfer this to a cell value (text) in a specific cell

  3. #3
    Forum Contributor
    Join Date
    03-20-2013
    Location
    London, England
    MS-Off Ver
    Excel 2011
    Posts
    474

    Re: hide columns if a cell has a specific word

    ive had a try but i cant get it to work.

    this is the code ive done (not sure how far off i am):
    Please Login or Register  to view this content.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: hide columns if a cell has a specific word

    How about an Input box

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Forum Contributor
    Join Date
    03-20-2013
    Location
    London, England
    MS-Off Ver
    Excel 2011
    Posts
    474

    Re: hide columns if a cell has a specific word

    i think youve misunderstood me.

    i dont want to use option buttons.
    i want to use text from a drop down box in cell ER11.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: hide columns if a cell has a specific word

    What are all your criteria and the columns that are associated with each selection. Rather than do this piecemeal. Give us the whole picture so it can be resolved at once.

  7. #7
    Forum Contributor
    Join Date
    03-20-2013
    Location
    London, England
    MS-Off Ver
    Excel 2011
    Posts
    474

    Re: hide columns if a cell has a specific word

    sure.

    in my drop down box i have the options: Apple; Banana; and Orange because I have 3 maps (Apple; Banana; and Orange).
    The dropdown box is in cell D1

    The Apple Map stretches from column F to I
    The Banana Map stretches from column K to N
    The Orange Map stretches from column Q to T

    hope that helps. thanks

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: hide columns if a cell has a specific word

    Try this:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    03-20-2013
    Location
    London, England
    MS-Off Ver
    Excel 2011
    Posts
    474

    Re: hide columns if a cell has a specific word

    theres an error. it says:

    Compile error:
    Ambiguous name detected: Worksheet_SelectionChange


    it highlights this: Private Sub Worksheet_SelectionChange(ByVal Target As Range

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,884

    Re: hide columns if a cell has a specific word

    I tested and it worked for me. Suggest you upload a sample spreadsheet that is representative of yours. Did you change any of the code? Or did you install in the worksheet as shown?

    Alan

+ 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] Hide columns based on specific cell value
    By samcdavies in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2013, 05:53 AM
  2. Hide/Unhide Columns Depending on a specific cell value
    By DaveM13 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-19-2012, 06:01 PM
  3. Hide specific columns dependant on number in specific cell
    By ladbroke in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2012, 04:46 PM
  4. Hide columns with 0 in a specific cell
    By Poldark in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2012, 05:27 AM
  5. using VBA to hide columns and rows that do not have cells with a specific format
    By fecurtis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2008, 05:47 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