+ Reply to Thread
Results 1 to 3 of 3

VBA Coding to enable sorting but DISABLE filtering

Hybrid View

  1. #1
    Registered User
    Join Date
    07-23-2012
    Location
    uk
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    6

    VBA Coding to enable sorting but DISABLE filtering

    Hello, I've trawled the net and found endless posts/replies about enabling filtering but disabling sorting, but couldn't find any about doing the opposite.

    I've got the following code in the relevant sheet (which I want to be protected upon opening):

    Private Sub Worksheet_Activate()
    With Sheet4

    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
    , AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowSorting:= _
    True, AllowFiltering:=True
    End With
    End Sub

    This allows filtering, but if I try to sort A-Z (or Z-A) I get a message: "The cell or chart you are trying to change is on a protected sheet. To make changes, click Unprotect Sheet in the Review tab (you might need a password)."


    If I change it to the following (which in my head should work):

    Private Sub Worksheet_Activate()
    With Sheet4

    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
    , AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowSorting:= _
    True, AllowFiltering:=false
    End With
    End Sub

    It just disables the filter buttons entirely.

    So I have 2 problems. Firstly getting the sorting to work, and secondly disabling the ability to filter. Please help!

    Thanks.

  2. #2
    Registered User
    Join Date
    07-23-2012
    Location
    uk
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    6

    Re: VBA Coding to enable sorting but DISABLE filtering

    Wow. I was worried that this was too stupid-a-question and you guys would solve it easily. Come on, surely people have come across this issue before? No replies in nearly a week?! Have I phrased it unclearly? Any help/suggestions v v v welcome. Thanks.

  3. #3
    Registered User
    Join Date
    07-23-2012
    Location
    uk
    MS-Off Ver
    Excel 2007 & 2013
    Posts
    6

    Re: VBA Coding to enable sorting but DISABLE filtering

    Can nobody help me with this? Has anybody else had this problem? Is it not clear what I'm asking? Please please help! Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Disable sorting but allow filtering
    By EdwardStephenson in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-23-2014, 05:47 AM
  2. Enable/disable copy paste (disable part not working)
    By timtim89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-08-2012, 07:23 PM
  3. Enable and disable
    By rajeev.raj in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-10-2010, 02:50 AM
  4. Enable / Disable CD-ROM thru VB
    By Lochdanon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-02-2009, 10:43 AM
  5. Enable / Disable CommandBarControl
    By DCSwearingen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2008, 03:07 PM
  6. Macro Enable/Disable
    By Marcus B in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2006, 10:55 AM
  7. [SOLVED] Enable/Disable Macros
    By Ben Schaum in forum Excel General
    Replies: 1
    Last Post: 01-21-2005, 12:06 PM

Tags for this Thread

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