+ Reply to Thread
Results 1 to 2 of 2

Allow table sorting/filtering in protected sheet.

  1. #1
    Registered User
    Join Date
    12-20-2012
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2007
    Posts
    14

    Cool Allow table sorting/filtering in protected sheet.

    Hello,

    I am new to the forum and having a problem.

    I have a table with 12 or so columns of data for an end user. Data will continue to be entered down rows as the user aquires it. I want to protect the worksheet but retain the ability to sort and filter each column. I have this code so far:

    Please Login or Register  to view this content.

    but there are three problems:

    1. I need this to be done on the fly, the user can't go run the macro each time he/she wants to sort, it needs to be automatic.

    2. I need to be able to sort/filter all 12 columns of data, not just column A. and

    3. If the user adds data in a row, this should also be included in the sort/filter (i.e. code needs to recognize where the last row containing data is located)

    Any suggestions are much appreciated

    Bob B

  2. #2
    Registered User
    Join Date
    02-20-2014
    Location
    KSA
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Allow table sorting/filtering in protected sheet.

    try this :


    Private Sub Worksheet_Change(ByVal Target As Range)

    With ThisWorkbook.Worksheets("Sheet1")
    .Unprotect Password:="password"
    .Range(.Range("A1").CurrentRegion.Address).sort _
    Key1:=.Range("A1"), _
    Order1:=1, _
    Header:=1, _
    OrderCustom:=1, _
    MatchCase:=False, _
    Orientation:=1, _
    DataOption1:=1
    .Protect Password:="password", _
    AllowFiltering:=True
    End With

    End Sub

+ Reply to Thread

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