+ Reply to Thread
Results 1 to 11 of 11

Macro unhides rows, how can it unhide and hide?

  1. #1
    Registered User
    Join Date
    04-11-2023
    Location
    england
    MS-Off Ver
    MS365 version 2304
    Posts
    23

    Macro unhides rows, how can it unhide and hide?

    Hi,

    I currently have a button with a macro (see below) which unhides row 65, is there any way this can be adapted so that it unhides row 65 but also hides rows 66:85 ?

    Thank you!!

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 06-22-2023 at 08:10 AM. Reason: please use code tags

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,673

    Re: Macro unhides rows, how can it unhide and hide?

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    Do not use Select, unless you need the user to see that something has been selected.

    Your code is based on code from the macro recorder. Here is a more efficient method.

    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-11-2023
    Location
    england
    MS-Off Ver
    MS365 version 2304
    Posts
    23

    Re: Macro unhides rows, how can it unhide and hide?

    Thank you very much

  4. #4
    Registered User
    Join Date
    04-11-2023
    Location
    england
    MS-Off Ver
    MS365 version 2304
    Posts
    23

    Re: Macro unhides rows, how can it unhide and hide?

    Hi - sorry this doesn't seem to work..... any idea what I could be doing wrong? Thanks

  5. #5
    Registered User
    Join Date
    06-22-2023
    Location
    North Carolina, USA
    MS-Off Ver
    Microsoft Office 365
    Posts
    1

    Re: Macro unhides rows, how can it unhide and hide?

    Hello, I'm very new here, and I'm still learning how to use Excel VBA.
    I have a code I use to do a very similar thing.

    Please Login or Register  to view this content.
    Please tell me if it doesn't work.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,673

    Re: Macro unhides rows, how can it unhide and hide?

    Sorry there was a paste error in the code. Here is a sample file with the correct code.

    Your original post said "which unhides row 65," but your code actually hides it if is visible, and unhides it if it is hidden. That is what my code does. In addition, it unhides 66:85 if 65 is hidden, and hides 66:85 if 65 is unhidden.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-11-2023
    Location
    england
    MS-Off Ver
    MS365 version 2304
    Posts
    23

    Re: Macro unhides rows, how can it unhide and hide?

    Working great now!! Thank you so much.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,673

    Re: Macro unhides rows, how can it unhide and hide?

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking addreputationiconsmall.jpg below their name.

  9. #9
    Registered User
    Join Date
    04-11-2023
    Location
    england
    MS-Off Ver
    MS365 version 2304
    Posts
    23

    Re: Macro unhides rows, how can it unhide and hide?

    Hi,

    Sorry I'm still struggling here. I've had to change the requirement slightly and need non contiguous rows to unhide, so row 67, and 69-89. So it would leave row 68 hidden.

    Are you able to help at all?

    Thanks
    Danielle

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,673

    Re: Macro unhides rows, how can it unhide and hide?

    The code is explicit about which rows it acts on. If you need to use different rows, just change 65 to 67, 66 to 69, and 85 to 89.

  11. #11
    Registered User
    Join Date
    04-11-2023
    Location
    england
    MS-Off Ver
    MS365 version 2304
    Posts
    23

    Re: Macro unhides rows, how can it unhide and hide?

    Thanks - my brain is fried, no idea why I couldn't figure this out formyself!!

    Appreciate your help!

    Danielle

+ 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. Macro to Hide and Unhide Rows?
    By tomcre in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-26-2021, 02:37 PM
  2. Macro to Hide/Unhide rows with zero value
    By 4sodapops in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-30-2014, 01:43 PM
  3. Hide/Unhide Rows macro
    By nvalencia in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-08-2012, 01:44 PM
  4. Hide/Unhide rows using a macro
    By Jazzy Max in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-10-2012, 07:03 AM
  5. Hide/Unhide Rows Macro
    By wpwalsh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-07-2011, 08:42 AM
  6. Hide and UnHide more Rows with macro
    By antoni in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2009, 05:48 AM
  7. Macro to Hide/Unhide Rows
    By pgwolfe in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-24-2008, 09:02 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