Sort protected sheet
I have a sheet which has pasted links from another sheet but
consolidates the information, I can sort this information if the sheet is unprotected, but not if it is protected. I really need to protect the sheet to stop inadvertently overwriting the pasted link. I think I can do this by having the Macro unprotect, do the sort and then reprotect. Is there a way of doing this easier? and is there a way of stoping anyone of reading a macro which at times is as important as protecting the data it points to. Thanks EPJ |
Sort protected sheet
just an example.
this protects the sheet, but allows code to run while it's protected. in the thisworkbook module you could have something like this: Private Sub Workbook_Open() Worksheets("Sheet1").Protect UserInterfaceOnly:=True End Sub then you could have your sort code like this: Sub sort() With Worksheets("Sheet1").Range("A1:C10") .Sort Key1:=.Range("A2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End With End Sub or you could just protect the sheet, then unprotect iwith code, run your sort code and then protect it again. -- Gary wrote in message ... I have a sheet which has pasted links from another sheet but consolidates the information, I can sort this information if the sheet is unprotected, but not if it is protected. I really need to protect the sheet to stop inadvertently overwriting the pasted link. I think I can do this by having the Macro unprotect, do the sort and then reprotect. Is there a way of doing this easier? and is there a way of stoping anyone of reading a macro which at times is as important as protecting the data it points to. Thanks EPJ |
All times are GMT +1. The time now is 11:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com