none
VBA - Hide blank row RRS feed

Answers

  • Hi sara,

    The following code shows how to hide bank row:

    Sub Hide_Minor()
        Sheets("Packing List").Select
         ActiveSheet.Unprotect
         Dim r As Range, c As Range
     Set r = Range("a9:e201")
     Application.ScreenUpdating = False
     For Each c In r.Rows
         If Len(c.Cells(1).Text) + Len(c.Cells(2).Text) = 0 Then
             c.EntireRow.Hidden = True
         Else
             c.EntireRow.Hidden = False
         End If
     Next c
            Contents:=True, Scenarios:=True
     Application.ScreenUpdating = True
     End Sub

    Hopefully it helps you.

    Best Regards,

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.


    • Edited by Lina-MSFT Wednesday, October 31, 2018 2:37 AM
    • Marked as answer by sara1984 Wednesday, October 31, 2018 1:46 PM
    Wednesday, October 31, 2018 2:32 AM

All replies

  • Do you mean one specific blank row? Or all blank rows? Or something else?

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Tuesday, October 30, 2018 3:42 PM
  • Hi sara,

    The following code shows how to hide bank row:

    Sub Hide_Minor()
        Sheets("Packing List").Select
         ActiveSheet.Unprotect
         Dim r As Range, c As Range
     Set r = Range("a9:e201")
     Application.ScreenUpdating = False
     For Each c In r.Rows
         If Len(c.Cells(1).Text) + Len(c.Cells(2).Text) = 0 Then
             c.EntireRow.Hidden = True
         Else
             c.EntireRow.Hidden = False
         End If
     Next c
            Contents:=True, Scenarios:=True
     Application.ScreenUpdating = True
     End Sub

    Hopefully it helps you.

    Best Regards,

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.


    • Edited by Lina-MSFT Wednesday, October 31, 2018 2:37 AM
    • Marked as answer by sara1984 Wednesday, October 31, 2018 1:46 PM
    Wednesday, October 31, 2018 2:32 AM
  • Thanks Lina. Have a good day.
    Wednesday, October 31, 2018 1:47 PM