+ Reply to Thread
Results 1 to 9 of 9

Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

  1. #1
    Registered User
    Join Date
    02-14-2012
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2010
    Posts
    97

    Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

    Hi There,

    I have 25 rows starting from 35 to 60 that get populated by a beforedouble click function.
    The fields that aren't populated look un-sightly, so I was wondering if you could hide the unpopulated ones but leave the first 5 rows unhiden, and when the last unhiden row gets populated it would unhide another row ready to be populated?

    I hope this makes sense!

    P.s hopefuly with VBA.

    Any help would be much apreciated.

    Regards
    Carl

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

    I think i captured all the situations you will run into. Let me know if I missed anything:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-14-2012
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

    Hi Stnkynts,

    I've tried the code in sheet 2 but nothing happend, I forgot to mention that columbs B to H are the only ones used and there are a few drop down lists by Data Val but still nothing when cleared.

    Hope this helps.

    Regards
    Carl

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

    Lol, you just "forgot to mention" a huge part. Of course the code didn't work. It is based on column A.

  5. #5
    Registered User
    Join Date
    02-14-2012
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

    Haha sorry about that, I get told off at work for not explaining myself properly too.
    I've uploaded the workbook in question.


    Kind Regards
    Carl
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

    Try this: Put in second sheet not the first.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-14-2012
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

    Hey stnkynts,

    I had a bit play around with the code and its working great, thanks for your help with this, its much apreciated.

    Kind Regards
    Carl

  8. #8
    Registered User
    Join Date
    02-14-2012
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

    Hi Folks,

    The current code hides rows E33:E58 and unhides one row at a time if the previous row is populated and works great, but now i need it to do the same to another set of rows too (rows E61:E86), i thought i would be able to copy the code and just change the cell address but no joy! any help would be great :o)

    Thanks in advance

    [Private Sub Worksheet_Change(ByVal Target As Range)

    On Error Resume Next
    If Not Intersect(Target, Range("E33:E58")) Is Nothing Then
    Application.ScreenUpdating = False
    Dim LR As Long
    LR = Range("E58").End(xlUp).Row
    If Not IsEmpty(Range("E58")) Then
    Range("E33:E58").EntireRow.Hidden = False
    Exit Sub
    End If
    If Range("E58").EntireRow.Hidden = False Then
    Range("E" & LR + 2, "E58").EntireRow.Hidden = True
    Else
    If Not IsEmpty(Target.Offset(1, 0)) Then
    Target.End(xlDown).Offset(1, 0).EntireRow.Hidden = False
    Else
    Target.Offset(1, 0).EntireRow.Hidden = False
    End If
    End If
    End If

    End Sub]

  9. #9
    Registered User
    Join Date
    02-14-2012
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Auto hide/unhide rows that have empty cells ( Preferably VBA Code)

    Hi stnkynts,

    Any chance you could add another set of rows (E61:E86) to the above code you kindly created for me please, i've tried but couldn't get it to work
    Any help would be great

    Thanks in advance

+ Reply to Thread

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