+ Reply to Thread
Results 1 to 5 of 5

Hide rows in different areas when cell is 0

  1. #1
    Registered User
    Join Date
    03-15-2012
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2016
    Posts
    77

    Hide rows in different areas when cell is 0

    Hello!

    I`ve made a macro which hide row when cell CQ364: CQ718 =0. Now I realise, the best would be to have the same function in C725:C1081, but I can`t make it work. Thanks for any reply!

    Best regards Ossa

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Hide rows in different areas when cell is 0

    Hi ossa,

    I believe you need to change the reference in your existing code.
    If the code is written on relative reference, you need to select C725 and run the macro.

    Share the code in case of any issues. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  3. #3
    Registered User
    Join Date
    03-15-2012
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2016
    Posts
    77

    Re: Hide rows in different areas when cell is 0

    Thanks for reply! Thus is my code right now. Is it possible to enter the other range in this code as well.



    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.ScreenUpdating = False
    Dim c As Range
    For Each c In Range("CQ364:CQ717")
    If c.Value = 0 Then
    Rows(c.Row).Hidden = True
    Else
    Rows(c.Row).Hidden = False
    End If
    Next c
    Application.ScreenUpdating = True

    End Sub

  4. #4
    Registered User
    Join Date
    03-15-2012
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2016
    Posts
    77

    Re: Hide rows in different areas when cell is 0

    Actually, I made it just "," and then the other range
    Last edited by ossa; 05-08-2012 at 07:48 AM.

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Hide rows in different areas when cell is 0

    yes.. you need to include the other range in "For Each c In Range("CQ364:CQ717")"...

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

+ 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