Hi,
Hope someone can help I'm getting an error on the highlighted part of the code below?
This occurs when I'm referencing a sheet by its code name and not its tab name.
Any help or advance??
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
Thanks in advance
J
Hope someone can help I'm getting an error on the highlighted part of the code below?
This occurs when I'm referencing a sheet by its code name and not its tab name.
Any help or advance??
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
Thanks in advance
J