LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
RS RS is offline
external usenet poster
 
Posts: 113
Default Sorting macro needed on a protected sheet

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting in a protected sheet Topgun505 Excel Discussion (Misc queries) 1 February 5th 10 05:56 PM
macro for sorting in protected sheet vcff Excel Discussion (Misc queries) 16 October 22nd 07 03:04 PM
Sorting a protected sheet Rusty Excel Worksheet Functions 1 April 19th 07 03:10 AM
Sorting Protected Sheet grim Excel Programming 1 April 3rd 05 01:36 PM
Sorting Protected Sheet Alphonse Giambrone Excel Programming 4 December 4th 03 03:55 PM


All times are GMT +1. The time now is 02:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"