Results 1 to 8 of 8

hide and protected sheet macro not working

Threaded View

Anisusa hide and protected sheet... 01-14-2017, 08:46 AM
cytop Re: hide and protected sheet... 01-14-2017, 08:52 AM
Anisusa Re: hide and protected sheet... 01-14-2017, 09:12 AM
cytop Re: hide and protected sheet... 01-14-2017, 12:15 PM
Anisusa Re: hide and protected sheet... 01-14-2017, 12:53 PM
cytop Re: hide and protected sheet... 01-14-2017, 01:11 PM
Anisusa Re: hide and protected sheet... 01-14-2017, 01:12 PM
Anisusa I posted it already... Now... 01-14-2017, 01:49 PM
  1. #1
    Forum Contributor
    Join Date
    12-14-2016
    Location
    UAE
    MS-Off Ver
    MS OFFICE LTSC 2024
    Posts
    158

    hide and protected sheet macro not working

    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.

    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"
        ActiveSheet.ListObjects("Table2").Range.AutoFilter Field:=1
        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
    Sub REFRESHBUTTON()
    Dim Pvt As PivotTable
        For Each Pvt In Sheets("sheet7").PivotTables
            Pvt.RefreshTable
                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
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro Button not working for protected Sheet
    By sunny81 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2015, 02:24 AM
  2. [SOLVED] allow hide/unhide rows&columns when sheet protected (macro)
    By jw01 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-15-2013, 03:18 AM
  3. Macro and grouping not working in Protected sheet
    By ranjuv in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2012, 06:49 AM
  4. Replies: 1
    Last Post: 08-19-2011, 10:25 AM
  5. Macro not working when sheet is protected.
    By ebin charles in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-2011, 06:10 AM
  6. Hide rows on a protected sheet with macro
    By darthshani in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-12-2009, 03:40 AM
  7. [SOLVED] Macro to hide rows-sheet is being protected
    By Alex in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-07-2005, 03:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1