ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA in Excel, Know a way to disable SORT without protectsheet? (https://www.excelbanter.com/excel-discussion-misc-queries/95583-vba-excel-know-way-disable-sort-without-protectsheet.html)

zulfer7

VBA in Excel, Know a way to disable SORT without protectsheet?
 
Can Anyone Help?

Neil

VBA in Excel, Know a way to disable SORT without protectsheet?
 
"zulfer7" wrote:

Can Anyone Help?


Hi,

Try adding the following line to an 'Auto_Open' macro in your workbook:

CommandBars("Worksheet Menu_ Bar").Controls("Data").Controls("Sort").Enabled
= False

You will need to change this back again again by changing 'False' to 'True'
when you leave your workbook.

HTH

Neil
www.nwarwick.co.uk


zulfer7

VBA in Excel, Know a way to disable SORT without protectsheet?
 
For some reason I have to add ... to the sort command but it works fine now.
Thanks!
Sub auto_open()

CommandBars("Worksheet Menu
Bar").Controls("Data").Controls("Sort...").Enable d = False

End Sub

"Neil" wrote:

"zulfer7" wrote:

Can Anyone Help?


Hi,

Try adding the following line to an 'Auto_Open' macro in your workbook:

CommandBars("Worksheet Menu_ Bar").Controls("Data").Controls("Sort").Enabled
= False

You will need to change this back again again by changing 'False' to 'True'
when you leave your workbook.

HTH

Neil
www.nwarwick.co.uk



All times are GMT +1. The time now is 04:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com