Results 1 to 5 of 5

Classic hide rows if cell value is zero - not working, please help!

Threaded View

  1. #1
    Registered User
    Join Date
    11-12-2012
    Location
    Mars
    MS-Off Ver
    Excel 2007
    Posts
    2

    Classic hide rows if cell value is zero - not working, please help!

    I have drop downs on another sheet that control cells so that if the drop down is the same as the value next to the cell it shows a 1 if not a zero.

    I want to hide the rows that contain cells with a zero and have read forum answers but for some reason this isn't working. It comes up with Error 1001 object defined or application defined error and highlights

    "Rows(rCell).EntireRow.Hidden = True".

    Or says my argument isn't optional.

    I would also like to expand this and hide irrelevant columns as well once this is cracked.


    Private Sub Worksheet_Change(ByVal Target As Range)
             
     Dim rCell, rRange As Range
    
        For Each rCell In Range("B10:B921")
            
            If rCell.Value = 0 Then
       
                Rows(rCell).EntireRow.Hidden = True
                
             End If
         
             If rCell.Value = 1 Then
             
                Rows(rCell).EntireRow.Hidden = False
              
             End If
            
            Next
    
    End Sub
    Any help is appreciated.

    Thanks

    D

    Moderator's Edit: Use code tags when posting code. To do so, select your code and click on the # icon above.
    Last edited by arlu1201; 11-12-2012 at 08:04 AM.

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