首页 > 解决方案 > 使用“LookIn:=xlFormulas”查找似乎不适用于我的表

问题描述

我怎样才能让它在隐藏的行中查看?这只有在我每次都过滤我的表时才有效。我原以为“LookIn:=xlFormulas”可以解决问题,但事实并非如此。

Sub MarkCompleted1()
    Application.ScreenUpdating = False
    Range("Table1[[#Headers],[SO'#]]").Select
    If Range("C:C").Find(What:=Range("S1").Value, After:=ActiveCell, _
            LookIn:=xlFormulas, LookAt:=xlWhole, MatchCase:=False) _
            Is Nothing Then
        ActiveSheet.Range("S1").Select
        MsgBox "Sales Order # " & Range("S1") & " Not Found", _
            vbInformation, "Information"
    Else:
        Range("C:C").Find(What:=Range("S1").Value, After:=ActiveCell, _
            LookIn:=xlFormulas, LookAt:=xlWhole, MatchCase:=False).Activate
        MarkCompleted2
    End If
End Sub

标签: vbaexcel

解决方案


工作表的 MATCH 函数查找隐藏的行和列。

Sub MarkCompleted1()
    dim m as variant

    m = application.match(Range("S1").Value, columns(3), 0)

    If iserror(m) Then
        Range("S1").Select
        MsgBox "Sales Order # " & Range("S1") & " Not Found", vbInformation, "Information"
    Else
        Range("C" & m).Activate
        MarkCompleted2
    End If

End Sub

推荐阅读