Results 1 to 4 of 4

Sheet Protection Interference

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,051

    Sheet Protection Interference

    I've got a small macro that's giving me problems, and I don't understand why. Sheets WS and WS2 are both protected, and on the settings for the protection I've checked "Allow Autofilter". On sheet WS2 the user selects a value in a data validation cell (E1). Then my macro takes that value to apply to the autofilter in WS. However, I'm getting a Run-Time error 1004 saying I can't run this command on a protected sheet (line beginning "ws.Range("N:N")...). Any help on this would be immensely appreciated.

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim ws As Worksheet:    Set ws = Sheets("View1Pivot")
    Dim ws2 As Worksheet:   Set ws2 = Sheets("Chart-View 1")
    
    
    If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
    
        If Target.Address = "$E$1" Then
        
        ws.Range("N:N").AutoFilter Field:=1, Criteria1:=ws2.Range("E1").Text
    End If
    
    End Sub
    Last edited by jomili; 01-19-2011 at 11:52 AM.

Thread Information

Users Browsing this Thread

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

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