+ Reply to Thread
Results 1 to 3 of 3

Modify code to hide rows based on the contents in a cell.

  1. #1
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Modify code to hide rows based on the contents in a cell.

    Hello, I am using the code below to hide all rows with the text "Solar" in the specified range. How can I modify this so that instead of looking for "Solar" it can be set to look in a cell that will be a data validation list. My goal is for the user to be able to show only the rows that have the word they selected from the list. I would like for it to change when ever the word is clicked on in the list if possible. I would also like for their to be an option to show all rows if the word "All" is selected.

    If there is a faster way to accomplish what I am doing please let me know. As it is the code slows down my computer pretty badly.

    Thanks!
    Clayton

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Modify code to hide rows based on the contents in a cell.

    Hello Clayton,

    When you need to check a large number of cells, it is faster to store the cell values in a Variant Array. Also, using the Like operator is faster way to search for and match text in a string.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Re: Modify code to hide rows based on the contents in a cell.

    Thanks Leith! How would I make this search the contents of one particular cell instead of the word "Solar"? My goal is to have a data validation list that the user selects a word from and the macro will hide all rows without that word in them. You could use cell H3 as the cell the list is in if you need to.


    Thanks!
    Clayton
    Last edited by dcgrove; 06-19-2009 at 06:13 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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