+ Reply to Thread
Results 1 to 4 of 4

How to hide and unhide columns with the same button

  1. #1
    Registered User
    Join Date
    12-19-2020
    Location
    Turkey
    MS-Off Ver
    2019
    Posts
    19

    How to hide and unhide columns with the same button

    Hi All,

    I am trying to write a code where I can hide all columns that contains "0" in a specific cell in each column. The values are linked to another sheet and they are dynamic as they will change as new data arrives. I have managed to do this bit but some of the cells which previously were "0" are bound to change and hence I will no longer want them to be hidden anymore.

    So I tried to embed an extra line of code which commands to unhide all columns and then run the above mentioned code so that everything will be refreshed. My code does not seem to work though; probably because I am not ending the first command properly and telling VBA to run the next code or it just loops the first one. It must be something very simple, however, I am not certain at all.

    Below is the code I have tried and failed with.

    Any help will be much appreciated.

    Many thanks in advance!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: How to hide and unhide columns with the same button

    Hi try

    Please Login or Register  to view this content.
    Last edited by JEC.; 07-25-2023 at 02:13 PM.

  3. #3
    Registered User
    Join Date
    12-19-2020
    Location
    Turkey
    MS-Off Ver
    2019
    Posts
    19

    Re: How to hide and unhide columns with the same button

    This works. Thank you!

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: How to hide and unhide columns with the same button

    The values are linked to another sheet and they are dynamic as they will change as new data arrives.
    You can run code automatically when the values change so you don't have to push a button.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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