Excel 2016 - VBA错误参考表

时间:2016-08-02 00:14:53

标签: vba excel-vba listobject excel

希望有人可以帮助我通过>>>>>>获得以下代码的错误在它旁边?

当我按照代码名称而不是其标签名称引用工作表时会发生这种情况。

任何帮助或建议??

Private Sub CommandButton1_Click()

 Dim lngStart As Long, lngEnd As Long
    lngStart = Sheet5.Range("A2").Value 'assume this is the start date
    lngEnd = Sheet5.Range("A3").Value 'assume this is the end date

    Application.ScreenUpdating = False
    Sheet100.Visible = True
    Sheet105.Visible = True

    'assume you have field name / label in D29
    Sheet100.Unprotect Password:="MM@MM.com"
    Sheet100.Select
   >>>>>>>>> ActiveSheet.ListObjects("tbl_summary_1").Range.AutoFilter field:=8,
   >>>>>     Criteria1:=">=" & lngStart, _
   >>>>>     Operator:=xlAnd, _
   >>>>>     Criteria2:="<=" & lngEnd
    Sheet100.Protect Password:="MM@MM.com", AllowFiltering:=True
    ActiveSheet.EnableSelection = xlUnlockedCells

    Sheet105.Unprotect Password:="MM@MM.com"
    Sheet105.Select
    ActiveSheet.ListObjects("tbl_kpi").Range.AutoFilter field:=7, _
        Criteria1:=">=" & lngStart, _
        Operator:=xlAnd, _
        Criteria2:="<=" & lngEnd
    Sheet105.Protect Password:="MM@MM.com", AllowFiltering:=True
    ActiveSheet.EnableSelection = xlUnlockedCells

    Sheet3.Select

    Sheet100.Visible = xlVeryHidden
    Sheet105.Visible = xlVeryHidden
    Application.ScreenUpdating = True

On Error GoTo ErrorHandler
Sheets(Range("H19").Value).Select
Exit Sub

提前谢谢你 Ĵ

0 个答案:

没有答案