Select some of the first 10 lines you want to hide, and then try running
Option Explicit Sub CheckIfVisible() Dim i As Integer, x As Integer x = 0 For i = 1 To 10 With Excel.ThisWorkbook.ActiveSheet If .Rows(i).EntireRow.Hidden Then Else .Cells(15 + x, 1) = "Row " & i & "is visible" x = x + 1 End If End With Next i End Sub
Is this the type of loop you are looking for?
Maybe you can show us your loop so we can see where your problem is?
source share