+ Reply to Thread
Results 1 to 14 of 14

Autohiding duplicates then unhiding again.

  1. #1
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Autohiding duplicates then unhiding again.

    Hello all,

    I am looking for a vba, or macro that will autohide all rows after a freeze pane except for the last row of a set of duplicates.

    I am looking to attach this vba to a button on the spreadsheet so, I would like the user to push the button to hide everything and then the user would push the button again to unhide everything.

    I hope this makes sense. I have been looking for something like this all over the place but everything is all about deleting these rows and that is not what I am wanting.

    If I need to attach a workbook with before and after I please let me know.

    Thank you all in advance for your help.
    Last edited by whatsmyname; 08-11-2010 at 11:14 AM.

  2. #2
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Autohiding duplicates then unhiding again.

    I'm just replying to post question back at the top of the board, to see if there is anyone who could helo me with this.

    Thank you.

  3. #3
    Forum Contributor
    Join Date
    08-21-2008
    Location
    Hamilton, New Zealand
    MS-Off Ver
    Office 2007
    Posts
    255

    Re: Autohiding duplicates then unhiding again.

    post a sample workbook for starters. And indicate which data is the key to if the row a duplicate or not, or is it all cells within the row.

  4. #4
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Autohiding duplicates then unhiding again.

    Okay, I posted a sample workbook.

    There are 2 sheets, (Before) and (After).

    Of course the Before sheet is what I have before, and the After sheet is what I am wanting a vba to do.

    But, I need it the macro to be able to hide and unhide. I am going to attach it to a button on the sheet and when it is clicked it will switch back and forth.

    As you can see I just need the code to look at the set of duplicates and hide every row above the last row in that set of duplicates. Then I need the code to unhide those rows again at the users request. Also, as you can see I am alos hiding columns F,J,M at the same time.

    I have found alot code as far as deleting duplicates and or rows, but not hiding them.

    Any help is greatly appreciated. Thank you.
    Attached Files Attached Files

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Autohiding duplicates then unhiding again.

    Here's the code:
    Please Login or Register  to view this content.

    I've already attached it to a button for you on the Before sheet. I also streamlined some of your other macros...compare my version to your original to see how much extra dross is added by the macro recorder that you can tweak out later.
    Attached Files Attached Files
    Last edited by JBeaucaire; 08-07-2010 at 09:31 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  6. #6
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Autohiding duplicates then unhiding again.

    Hey JB,

    Thank you so much for your help. Your code works perfectly. I even decided that instead of hiding I would rather delete the extra rows, and I figured that out for myself!!! Yeah! LOL.

    But, when I copy the code over to my main spreadsheet I get an error that I need to debug.

    I've tried on my own and I'm not having any success. Boo! LOL.

    The line of cod e that highlights yellow when I click on debug is:

    Please Login or Register  to view this content.
    When I put my curser over it it says:

    Please Login or Register  to view this content.
    Any idea on what I am doing wrong?

    Also, I am not putting a button on the spread sheet anymore, I'm adding a button on the toolbar. Would that have anything to do with it.

    Thank you so much for your help. I'm trying to self educate myself with a VBA for Dummies book but I am and probably will never be close to your knowledge.

    Thank you so much for your contribution.
    Last edited by whatsmyname; 08-05-2010 at 01:16 PM.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Autohiding duplicates then unhiding again.

    Quote Originally Posted by whatsmyname View Post
    Any idea on what I am doing wrong?

    There must be a substantive difference between the sample workbook and your main workbook. My code is using column H from row 5 down to spot all the cells with data and those that are blank. That's key to how everything else works.

    If you can't adjust the code for a workbook markedly different from your sample, post your main workbook. Desensitize it, but leave the format the same.

  8. #8
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Autohiding duplicates then unhiding again.

    Doing that now.

  9. #9
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Autohiding duplicates then unhiding again.

    Okay, I attached the original.

    I'm not to worried about de-sensitizing anything, this data is already fake data just to help build this report.

    You'll need to take the data that is selected on sheet2 and copy it and paste it into cell D9 on sheet1.

    Then run the complete() macro on module 5.

    Then try to run your code, which is on module 7. It should give you the same error that I am getting.

    I don't understand what is happening because it is still looking at columnH which is fine.

    If you could could you please explain to me what you are seeing and find for future reference please?

    Thank you.
    Attached Files Attached Files

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Autohiding duplicates then unhiding again.

    Heh... the problem jumped right out at me, your first "section" is only 1 row, so I need to add a test for that...there's nothing to "hide" in that section. Update this section:
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Autohiding duplicates then unhiding again.

    Quote Originally Posted by JBeaucaire View Post
    Heh... the problem jumped right out at me, your first "section" is only 1 row, so I need to add a test for that...there's nothing to "hide" in that section. Update this section:
    Please Login or Register  to view this content.

    Thank you so much JB!!! That worked beautifully! You're awesome! I will be sure to give you kudos!!

    Thanks again!

  12. #12
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Autohiding duplicates then unhiding again.

    Here is the complete code for anyone who needs it:

    Please Login or Register  to view this content.

    And for anyone looking for something like this but you need the rows deleted:
    Please Login or Register  to view this content.
    Thanks again JB!!
    Last edited by whatsmyname; 08-11-2010 at 02:05 PM.

  13. #13
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Autohiding duplicates then unhiding again.

    You should probably change the name of the second macro.

  14. #14
    Forum Contributor
    Join Date
    09-09-2009
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    185

    Re: Autohiding duplicates then unhiding again.

    Quote Originally Posted by JBeaucaire View Post
    You should probably change the name of the second macro.
    Will do. Sorry that would of been smart of me to do huh? Lol

    Thank you, I will take care of that.

+ 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