Excel VBA with filtered / visible cell

Suppose I have 10 rows of data. I apply some filter to the data, and line numbers 7 and 9 are filtered out OR .

I want to scroll through the data (10 rows) and display the row "Is Visible" in an empty column (suppose column C), only for visible rows (for example, Range C7 and Range C9).

+4
source share
1 answer

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?

+16
source

All Articles