使用“ LookIn:= xlFormulas”查找似乎不适用于我的表

时间:2018-08-28 01:18:22

标签: excel vba excel-vba

如何获取隐藏行中的内容?仅当我每次过滤表时,此方法才有效。我原以为“ 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

1 个答案:

答案 0 :(得分:0)

工作表的“匹配”功能在隐藏的行和列中查找。

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