且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Excel VBA筛选/可见单元格

更新时间:2022-12-12 14:29:08

选择要隐藏的前10行中的一些,然后尝试运行此行

Choose some of the first 10 rows to hide, and then try running this

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

这是您要寻找的循环吗?
也许您可以向我们展示您的Loop,以便我们查看您的问题出在哪里?

Is this the sort of loop you're looking for?
Maybe you can show us your Loop so we can see where your problem is?