In VBA, which relates to the ability to sort/autofilter?

TheJay

Active Member
Joined
Nov 12, 2014
Messages
364
Office Version
  1. 2019
Platform
  1. Windows
I am using the following code:

VBA Code:
Option Explicit

Private Sub Worksheet_Activate()
    Range("C4").Select
    With Worksheets("VO Areas")
    With ActiveWindow
        .DisplayFormulas = False
        .DisplayHeadings = False
        .DisplayGridlines = False
        .DisplayHorizontalScrollBar = False
        .DisplayVerticalScrollBar = False
    End With
    With Application
        .DisplayFullScreen = True
        .DisplayFormulaBar = False
        .DisplayStatusBar = False
    End With
    With Application
        .CommandBars("Full Screen").Visible = True
        .CommandBars("Worksheet Menu Bar").Enabled = False
        .CommandBars("Standard").Visible = False
        .CommandBars("Formatting").Visible = False
    End With
End With
End Sub

I have three columns that I want to be able to use the dropdown list on to be able to sort. If I define a range to allow users to edit, they can change the text in the headings but it does not allow the dropdown lists to be used. If I unprotect the worksheet and then lock it again with "Allow all users of this workbook to:" and tick "Sort" and "Use AutoFilter", it works. I save and it works. Then, I close and open the file again and the ability is lost and the options have been unticked.

Can someone please tell me how I can stop these options being disabled?
 
I think you are going to have to post this as a separate thread. It seems likely that you will have to share the workbook, its just too much code to wade through especially with not having any sample data to work with also doesn't help.
Also missing is, which actual line of code it is failing on (and a copy of the error message) ? Which protection method is being applied to the sheet "Search" ?
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I think you are going to have to post this as a separate thread. It seems likely that you will have to share the workbook, its just too much code to wade through especially with not having any sample data to work with also doesn't help.
Also missing is, which actual line of code it is failing on (and a copy of the error message) ? Which protection method is being applied to the sheet "Search" ?
I think you are right, I will need to spend some time stripping it in order to be able to share it. I'll crosslink once I have done it in case you find time to help.

Thank you very much.
 
Upvote 0

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top