Consulting

Results 1 to 4 of 4

Thread: Hide empty rows

  1. #1

    Hide empty rows

    Hi All,
    Been a long time since here,
    anyway I picked up on the following code that hides empty columns, I would like to know if there is a way to do this with rows.
    Thanks
    Lee

    [vba]Sub Button1_Click()
    Dim Col_Ct As Integer, i As Integer
    Col_Ct = Cells(1, Columns.Count).End(xlToLeft).Column
    For i = 1 To Col_Ct
    If WorksheetFunction.CountA(Range(Cells(1, i).Address, Cells(Rows.Count, i).Address)) < 2 Then
    Cells(1, i).EntireColumn.Hidden = True
    End If
    Next i
    End Sub[/vba]

  2. #2
    VBAX Regular
    Joined
    Nov 2011
    Location
    Ufa
    Posts
    75
    Location
    maybe so
    [VBA]Sub Button2_Click()
    Dim rws As Long, i As Long, Col_Ct As Long
    rws = Cells(Rows.Count, 1).End(xlUp).Row
    Col_Ct = Columns.Count
    For i = 1 To rws
    Cells(i, 1).EntireRow.Hidden = WorksheetFunction.CountA(Range(Cells(i, 1), Cells(i, Col_Ct))) < 2
    Next i
    End Sub[/VBA]

  3. #3
    Hi Nilem,
    Thanks for the response, I have attached the worksheet that I am trying to hide the rows, I would need to hide rows 189 to 292, although for each invoice there would be varying length's.
    Thanks
    Lee
    Attached Files Attached Files

  4. #4
    VBAX Regular
    Joined
    Nov 2011
    Location
    Ufa
    Posts
    75
    Location
    [VBA]Sub ertert()
    With Range("A24:A292")
    .EntireRow.Hidden = True
    .SpecialCells(2).EntireRow.Hidden = False
    End With
    End Sub[/VBA]
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •