+ Reply to Thread
Results 1 to 20 of 20

Hiding Rows using Macro

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016,office 365
    Posts
    69

    Hiding Rows using Macro

    Dear Experts,

    Any one can help me on the below code,this takes 5 to 6 mintues to complete


    Please Login or Register  to view this content.
    Last edited by arlu1201; 10-11-2012 at 06:10 AM. Reason: Use code tags in future

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hiding Rows using Macro

    What is the condition based on which you want to hide the rows?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    08-30-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016,office 365
    Posts
    69

    Re: Hiding Rows using Macro

    If cell contains "False"

  4. #4
    Registered User
    Join Date
    08-30-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016,office 365
    Posts
    69

    Re: Hiding Rows using Macro

    If from S3 to S47 cells contains as "False"

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hiding Rows using Macro

    Try this
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-30-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016,office 365
    Posts
    69

    Re: Hiding Rows using Macro

    Dear arlu1201
    Apologies for the replying delay,Thx for your reply,this above code is working fine but

    I have formula in sheet1 "S" column refers to sheet2.When I edit sheet2, then Sheet1 "S" column cell goes to either True or False.Based on above code again I need edit sheet1 "S" column formulas then only its hided. Pls amend the above when I edit sheet2 then automaticaly hide the sheet1 rows refers to "S" column cell result

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hiding Rows using Macro

    Right click on sheet2 and select view code. Copy this code in the code window.
    Please Login or Register  to view this content.
    Remember to remove the code from sheet 1 code window (which you put previously).

  8. #8
    Registered User
    Join Date
    08-30-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016,office 365
    Posts
    69

    Re: Hiding Rows using Macro

    Dear Arlu,
    Thnx for the quick response

    I am using the check box in sheet 2,based on the check box result I linked to sheet 1 "S" column, When i click the check box, this codes are not function until I edit something into the cell in sheet 2

    I looking forward to your valuable reply

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hiding Rows using Macro

    Do you have a sample file that you can upload showing the checkbox and linking?

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.

  10. #10
    Registered User
    Join Date
    08-30-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016,office 365
    Posts
    69

    Re: Hiding Rows using Macro

    Dear Arlu,
    Thx for your assistance
    Pls find teh attached file,In that Project Detail Tab
    When Check box 1 is false, then in "home page" row Nos:3 and 15:20 to be hidden,if it is true this should unhide
    When Check box 2 is False,then in "home page" row Nos:4 and 21:27 to be hidden,if it is true this should unhide
    When Check box 3 is False,then in "home page" row Nos:5 and 28:38 to be hidden,if it is true this should unhide
    When Check box 4 is False,then in "home page" row Nos:6 and 39:43 to be hidden,if it is true this should unhide
    When Check box 3 is False,then in "home page" row Nos:7 and 44:47 to be hidden,if it is true this should unhide
    Attached Files Attached Files

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hiding Rows using Macro

    I have created this code for you but its not working properly and am stuck regarding where its wrong. I have asked some of the experts here to look at it.
    The code is
    Please Login or Register  to view this content.

  12. #12
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Hiding Rows using Macro

    Hi Arlette, 2 things:

    1. Calculate Doesn't have a Target
    2. Calculate doesn't trigger since there are no formula dependencies - if you put in J1 =J2, Calculate will trigger on changing the value of the checkbox

  13. #13
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hiding Rows using Macro

    Thanks Kyle. But there are 5 checkboxes here. How do i get it to be triggered?

    The
    Please Login or Register  to view this content.
    was a typo. I had entered Change first and then edited it to Calculate and forgot to remove the parameters.

  14. #14
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Hiding Rows using Macro

    Well, you can put in J1 =J2 and drag across, that will trigger for any of the checkbox changes, but tbh I'd assign the same macro to each checkbox, saves the overhead of code in the calculate sub

    Application.Caller will return the name of the control that triggered the sub
    Last edited by Kyle123; 11-14-2012 at 06:18 AM.

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hiding Rows using Macro

    Thanks Kyle. I just everything in one sub itself to make it easier for the OP.

    Krishnakuma6,

    Use this code. Right click on the sheet Project Detail, select View code and copy this code over. Then test by clicking on the option buttons.
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    08-30-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016,office 365
    Posts
    69

    Re: Hiding Rows using Macro

    Dear Arlu,
    I tried this code as you said but its not working

  17. #17
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hiding Rows using Macro

    Oops i am sorry i missed the most important part.

    In J1 of the project detail tab, enter =J2 and drag it to the right. Then test by clicking on the option buttons.

  18. #18
    Registered User
    Join Date
    08-30-2012
    Location
    UAE
    MS-Off Ver
    Excel 2016,office 365
    Posts
    69

    Re: Hiding Rows using Macro

    Thx a lot arlu for spending your valuable time for me,now its working fine

  19. #19
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hiding Rows using Macro

    Thanks to Kyle also who helped to get the solution working.

  20. #20
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Hiding Rows using Macro

    No problem, thanks for the rep

+ 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