Hello...I have a macro to run in hide the worksheets that they protected sheet too. The macro runs a number of filters and drop down list that reside on each of the worksheets and is itself located in a module. the hide sheet if i running filters i am getting error and pivot table i cant refresh the table .Is there a way to run it on the hidden worksheets and protected sheet?. i am getting debug on the two code which is highlighted in red color kindly clear my code error and solve the problems.
one thing i have posted this problems in other forums too see the below link so if u see cross post pls avoid it.
http://www.excelforum.com/show…763&p=4560211#post4560211
http://www.vbaexpress.com/foru…rking&p=354962#post354962
Code
Sub monthsortout()
Application.ScreenUpdating = False
Dim serchdate As Integer
SearchDate = Cells(Application.Match(CDbl(DateValue("01/" & Range("F12").Value & "/" & Year(Range("B20").Value))), Range("B:B"), 1), 2).Value
Sheets("sheet2").Visible = True
ActiveSheet.Unprotect Password:="password"
[B][COLOR=#ff0000] ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=1[/COLOR][/B]
ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=1, Operator:= _
xlFilterValues, Criteria2:=Array(1, Month(SearchDate) & "/" & Day(SearchDate) & "/" & Year(SearchDate))
Sheets("sheet2").Visible = False
Sheets("sheet3").Visible = True
ActiveSheet.ListObjects("Table22").Range.AutoFilter Field:=1
ActiveSheet.ListObjects("Table22").Range.AutoFilter Field:=1, Operator:= _
xlFilterValues, Criteria2:=Array(1, Month(SearchDate) & "/" & Day(SearchDate) & "/" & Year(SearchDate))
Sheets("sheet3").Visible = False
ActiveSheet.Protect passowrd:="password"
Application.ScreenUpdating = True
End Sub
Display More
Code
Sub REFRESHBUTTON()Dim Pvt As PivotTable
For Each Pvt In Sheets("sheet7").PivotTables
[B][COLOR=#ff0000] Pvt.RefreshTable[/COLOR][/B]
Next Pvt
For Each Pvt In Sheets("sheet8").PivotTables
Pvt.RefreshTable
Next Pvt
For Each Pvt In Sheets("sheet9").PivotTables
Pvt.RefreshTable
Next Pvt
For Each Pvt In Sheets("sheet10").PivotTables
Pvt.RefreshTable
Next Pvt
ActiveWorkbook.RefreshAll
End Sub
Display More