+ Reply to Thread
Results 1 to 21 of 21

Macro for Hide Or Unhide Rows based on Cell Text

  1. #1
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Macro for Hide Or Unhide Rows based on Cell Text

    Hello Experts,

    I do have worksheet where a tab name P&L (CY Plan) and in column B from Cell 2 to Cell 269 where i am looking for the Macro for Hide and Unhide the rows based on Cell text if it includes "Blank" then the particular rows should be hidden and if the "Blank Text does not include then it should be appear.

    Request to you please do help me out Dear Experts.

    Thank you for your precious phase and valuable support.

    Regards,

    Neilesh

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,247

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    How does this differ from this thread?

    https://www.excelforum.com/excel-gen...ith-cells.html
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Quote Originally Posted by AliGW View Post
    How does this differ from this thread?

    https://www.excelforum.com/excel-gen...ith-cells.html
    Dear Expert,

    That required macro was with formula and if error and here i am looking for if the with formula where the result is "Blank" and i did tried but it is not working from my end. Request to you please help me out on the same.

    Thank you for your valuable support.

    Regards,

    Neilesh

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,247

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    OK - fine. You can continue in this new thread, then. However, I will move it to the correct section of the forum.

  5. #5
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Dear Experts,

    Request to you please do help me out on my thread.

    Regards,

    Neilesh

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,247

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Please be patient. Remember, those helping here do so voluntarily - this is not a paid 'service'. Those who help are living all over the globe.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,918

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Please supply a sample worksheet.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  8. #8
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Quote Originally Posted by alansidman View Post
    Please supply a sample worksheet.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Dear Experts,

    Please find here attached sample workbook where i am looking for the macro for the First Tab "P&L (CY Plan)". Request to you please do help me out.

    Thank you for your precious phase and valuable support.

    Regards,

    Neilesh
    Attached Files Attached Files

  9. #9
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Dear Experts,

    Request to you please do help me out on my thread.

    Regards,

    Neilesh

  10. #10
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Quote Originally Posted by Neilesh Kumar View Post
    Dear Experts,

    Request to you please do help me out on my thread.

    Regards,

    Neilesh
    @Neilesh

    Ali asked you only a couple of hours before your post to be patient and told you why.
    None of like being exhorted to step in and come up with a solution on demand. There are after all hundreds of others who are seeking help at the same time and constant chivvying will be counterproductive.

    If you need an instant service then put the request in the Commercial Services area with a note that you expect a result within say an hour - and be prepared to offer a premium for such a service.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,918

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    This worked for me in your example
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Quote Originally Posted by alansidman View Post
    This worked for me in your example
    Please Login or Register  to view this content.
    Dear Expert,

    Thank you so much for your precious support. Thanks a ton Sir.

    Regards,

    Neilesh

  13. #13
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Quote Originally Posted by alansidman View Post
    This worked for me in your example
    Please Login or Register  to view this content.
    Dear Experts,

    The provided code is not working in case of worksheet is protected with password and it is only works when the worksheet is unprotected. So may i expect the new macro code for the same in case of worksheet is protected with password.

    Thank you for your precious help and valuable support.

    Regards,

    Neilesh

  14. #14
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Dear Experts,

    Request to you, Please help me out on my raised thread. Thank you for your precious phase and valuable support.

    Regards,

    Neilesh

  15. #15
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,918

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Amend the code using this tutorial

    https://analysistabs.com/excel-vba/p...tect-workbook/
    Last edited by alansidman; 04-25-2017 at 09:44 AM.

  16. #16
    Registered User
    Join Date
    12-06-2016
    Location
    India
    MS-Off Ver
    2007
    Posts
    72

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Sub hhide()

    Dim rCell As Range
    Dim rRng As Range

    x = 1
    Set rRng = Sheet1.Range("C1:C600")

    For Each rCell In rRng.Cells
    x = x + 1
    If rCell.Value = "" Then
    rCell.EntireRow.Hidden = True


    End If

    Next rCell

    End Sub

  17. #17
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Dear Expert,

    I have gone through the article but the solution i could not find for my requirements. Request to you please do provide the macro here as per the requirement. Thank you for your precious help and valuable contribution.

    Regards,

    Neilesh

  18. #18
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,918

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Insert this at the beginning of your current code. Insert your password in the appropriate section of the code

    Please Login or Register  to view this content.
    Or

    Please Login or Register  to view this content.

  19. #19
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Quote Originally Posted by alansidman View Post
    Insert this at the beginning of your current code. Insert your password in the appropriate section of the code

    Please Login or Register  to view this content.
    Or

    Please Login or Register  to view this content.
    Dear Expert,

    The provided code throwing an error with message box "Compile error - Invalid outside procedure". Request to you kindly do provide the required code.

    Thank you for your precious phase and valuable support.

    Regards,

    Neilesh

  20. #20
    Forum Contributor Neilesh Kumar's Avatar
    Join Date
    05-26-2016
    Location
    INDIA
    MS-Off Ver
    2013 & 2016
    Posts
    847

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    Dear Experts,

    Request to you, Kindly do provide the required codes.

    Regards,

    Neilesh

  21. #21
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro for Hide Or Unhide Rows based on Cell Text

    The error message is telling you that the code you've added is not inside a procedure. i.e. not between a Sub() and End Sub block of code.
    I suspect you've added it above a Procedure.

+ 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] Macro to unhide & hide rows based on column value
    By qvfr034 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-15-2020, 03:00 PM
  2. Macro to Hide/Unhide Rows Based on Cell Value
    By mlancaster24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-07-2015, 01:20 PM
  3. [SOLVED] Macro to automatically hide or unhide rows based on either a value or no value in a cell
    By WFP111 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-04-2013, 12:28 PM
  4. [SOLVED] macro to hide rows if cell is blank, unhide if it contains text
    By Russ Fuquay in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2013, 10:02 PM
  5. simple macro to hide or unhide rows based on a cell value
    By Russ Fuquay in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-19-2013, 06:32 PM
  6. [SOLVED] hide or unhide rows based on text within a drop down list
    By souimet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2013, 01:32 AM
  7. Macro to Hide/Unhide Multiple Rows Based on Cell Value
    By mbp727 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2013, 11:12 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