Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone. I saw one of the threads in the Excel worksheet functions
section that suggested that any macro or vba questions should be posted here. So here goes... Sorry if some of you have seen this quesiton in the other forum, but I've gotten partial answers but no one has posted a solution (code) that I could copy into my worksheet. I've never done vb coding before, so that's why I'm seeking the assistance of the experts here. Here was my post: I know that Excel 2000 disables the autofilter function when the worksheet is protected and hence copied and modified a macro into "ThisWorkbook" that would fix this. However, I also just read that the sorting function is also disabled in Excel 2000. So my question is...how would I modify my existing macro (or add a new macro) to also allow me to sort? Here is the macro that I have in "ThisWorkbook": Private Sub Workbook_Open() 'check for filter, turn on if none exists With Worksheets("Worksheet") If Not .AutoFilterMode Then ..Range("A1").AutoFilter End If ..EnableAutoFilter = True ..Protect Password:="temp", _ Contents:=True, UserInterfaceOnly:=True End With End Sub Some of the comments I got were as follows: Gord Dibben wrote: "Most everybody winds up with code to unprotect, sort, then re-protect." Since I would need the macro to account for increasing numbers of rows as additional info is added to the spreadsheet, Bob Phillips wrote: "You can calculate the range like so Set rng = Range(Range("A1"),Range("A1").End(xlDown)) Since I don't know vb coding, how would I incorporate this into the existing macro? Would I need to paste a new macro code into the spreadsheet? If so, what would the code be? I guess that I would replace A1 with A49 since that's where the sorted data begins. I'm assuming based on Gord's comments, that if the macro has to unprotect, sort, and reprotect, that the person clicking on the macro won't be able to see what the password is? Am I right in this assumption? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting in a protected sheet | Excel Discussion (Misc queries) | |||
macro for sorting in protected sheet | Excel Discussion (Misc queries) | |||
Sorting a protected sheet | Excel Worksheet Functions | |||
Sorting Protected Sheet | Excel Programming | |||
Sorting Protected Sheet | Excel Programming |