+ Reply to Thread
Results 1 to 15 of 15

Hide or unhide column or columns based on checkboxes/s

  1. #1
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 365
    Posts
    1,255

    Hide or unhide column or columns based on checkboxes/s

    Hi,

    I have check boxes in B1,B2,B3,B4 and another data check boxes in G1,G2,G3,G4.

    Now B columns checkboxes are the names reflected in H4:Q4 and G columns checkboxes are the names reflected in H5:Q5.

    Now how to hide or unhide columns based on check /uncheck multiple columns.

  2. #2
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Hide or unhide column or columns based on checkboxes/s

    You'll get more responses if you attach a workbook so we don't have to try to recreate your scenario from a description ...
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  3. #3
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: Hide or unhide column or columns based on checkboxes/s

    You did not say if you are using Form controls or ActiveX controls.
    See the good advice of MatixMan.
    To give you a start this code hides column C and D with ActiveX checkbox.
    Please Login or Register  to view this content.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 365
    Posts
    1,255

    Re: Hide or unhide column or columns based on checkboxes/s

    Pls find in attachment.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Hide or unhide column or columns based on checkboxes/s

    Put this in the worksheet module of the Data sheet and move the checkboxes in col G so they are fully in col G (they overlap into Col F unlike those in col B that are properly aligned in col B).
    Please Login or Register  to view this content.
    Solution is in the attached file. MM.

  6. #6
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 365
    Posts
    1,255

    Re: Hide or unhide column or columns based on checkboxes/s

    When I copy the code to my real file it did not work.I have created the check boxes through active ctrlx.Am I missing G something.Kindly let me know.

  7. #7
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Hide or unhide column or columns based on checkboxes/s

    Does it work in the file i sent you?

  8. #8
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 365
    Posts
    1,255

    Re: Hide or unhide column or columns based on checkboxes/s

    Here the demo file that you have attached does the job as expected.

    But in my real workbook which has a lot of data and worksheets,I made the checkboxes through developer tab>active X and pasted your code in the specific worksheet as said above by u ,then it does not work,perhaps link could not be established between all 8 checkboxes with the code.
    Kindly guide with the series of steps.
    Last edited by paradise2sr; 05-05-2019 at 01:37 AM.

  9. #9
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 365
    Posts
    1,255

    Re: Hide or unhide column or columns based on checkboxes/s

    Hi,

    Pls find enclosed in attachment my file why your code does not work.Kindly let me know.
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Hide or unhide column or columns based on checkboxes/s

    There were / are a few issues.

    1. you didn't assign the macro to any of the checkboxes - this is now done in the attached file.
    2. you had full stops after some of the values - e.g. "Pure." instead of "Pure"
    3. you have two values in the same column ... I don't know what is supposed to happen with those, but the Find function won't find a hidden cell so if a column is hidden because a checkbox is unchecked and then another is checked but the column is hidden, it will stay hidden. Perhaps it's just test data?

    Hope that helps. MM.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 365
    Posts
    1,255

    Re: Hide or unhide column or columns based on checkboxes/s

    Oh! Now I got it and duly checked.It working awesome.
    Thanx a lot.

  12. #12
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Hide or unhide column or columns based on checkboxes/s

    You're welcome & thanks or the reps

  13. #13
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 365
    Posts
    1,255

    Re: Hide or unhide column or columns based on checkboxes/s

    Pls see further as I have added few more details and it is further prompting Run Time error-1004.When checkbox in B1:B4 & G1:G4 is either checked or unchecked.

    Kindly resolve this issue.
    Attached Files Attached Files

  14. #14
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Hide or unhide column or columns based on checkboxes/s

    You added checkboxes in the first column and the code is finding the label in the column to the left, which is causing the error. The If statement below stops the code if the checkbox is either in the first column or below row 4.
    Please Login or Register  to view this content.
    Last edited by MatrixMan; 05-09-2019 at 09:07 AM.

  15. #15
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 365
    Posts
    1,255

    Re: Hide or unhide column or columns based on checkboxes/s

    Great Work! Thanx again for your kind help

+ 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/Unhide columns based on whether 'x' appears in that column or not
    By BobZZ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2018, 10:32 AM
  2. Hide/unhide 2 columns based on checkbox
    By horsefish01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2015, 03:27 AM
  3. hide and unhide columns based on cell value
    By darijokesar in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-29-2014, 03:51 AM
  4. [SOLVED] Hide and Unhide Sheets using Checkboxes
    By DallasArosco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2014, 11:28 AM
  5. [SOLVED] Hide/unhide rows with checkboxes
    By mixer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-05-2014, 03:58 PM
  6. need macro to hide/unhide columns through multiple checkboxes
    By trier in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2013, 04:00 PM
  7. Hide/Unhide Multiple Checkboxes
    By LampCommandr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2011, 09:35 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