Hi,
I believe this will do the trick
Sub FirstThreeVisibleRows()
Dim counter As Long, theRange As Range, Cell As Range, visibleRange As Range
With Range("D8:H24")
On Error Resume Next
Set visibleRange = .Columns(1).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not visibleRange Is Nothing Then
If visibleRange.Count <= 3 Then
Set theRange = .SpecialCells(xlCellTypeVisible)
Else
For Each Cell In visibleRange.Cells
If counter = 0 Then
Set theRange = Cell.Resize(, .Columns.Count)
Else
Set theRange = Union(theRange, Cell.Resize(, .Columns.Count))
End If
counter = counter + 1
If counter = 3 Then Exit For
Next Cell
End If
theRange.Select
End If
End With
End Sub
Bookmarks