Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default FOLLOW-UP to PREVENT USERS (PROTECTION)

I have a followup question on protecting the worksheets.
I had a similar problems couple weeks aback, worked my way around it
but still haven't found exactly what I'm looking for.

I need a way to protect the worksheet, while allowing users to sort
columns. I know one of the options under tools-- protection says i
allows sorting, but it does not work..
this is what I've done:

ActiveSheet.Unprotect ("*****")

Set sortrange = Application.InputBox(prompt:="Click a cell in th
column to be sorted", Type:=8)
sortrange.Select
Range("A1:AA6000").Sort Key1:=sortrange, Order1:=xlAscending
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False
Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
' Protect the worksheet
ActiveSheet.Protect ("******")

End Sub

As u can see, I had to write VB code to first unprotect the sheet
allow sorting then return the protection....

Is there a much simpler way to do this

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default FOLLOW-UP to PREVENT USERS (PROTECTION)

Here is a double click event macro that sorts the named range by the double
clicked column.
right click sheet tabview codeinsert this.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel
As Boolean)
mycol = ActiveCell.Column
[SortRange].Sort Key1:=Cells(1, ActiveCell.Column), Order1:=xlAscending,
Orientation:=xlTopToBottom
End Sub
=
Now for the protection. If you have xl2002 you may allow users to sort. If
not then I imagine that surrounding this with an uprotect/protect would work
..Untested
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel
As Boolean)
ActiveSheet.Unprotect ("*****")
[SortRange].Sort Key1:=Cells(1, ActiveCell.Column), Order1:=xlAscending,
Orientation:=xlTopToBottom
ActiveSheet.Protect ("******")
End Sub



--
Don Guillett
SalesAid Software

"krazylain " wrote in message
...
I have a followup question on protecting the worksheets.
I had a similar problems couple weeks aback, worked my way around it,
but still haven't found exactly what I'm looking for.

I need a way to protect the worksheet, while allowing users to sort,
columns. I know one of the options under tools-- protection says it
allows sorting, but it does not work..
this is what I've done:

ActiveSheet.Unprotect ("*****")

Set sortrange = Application.InputBox(prompt:="Click a cell in the
column to be sorted", Type:=8)
sortrange.Select
Range("A1:AA6000").Sort Key1:=sortrange, Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
' Protect the worksheet
ActiveSheet.Protect ("******")

End Sub

As u can see, I had to write VB code to first unprotect the sheet,
allow sorting then return the protection....

Is there a much simpler way to do this?


---
Message posted from
http://www.ExcelForum.com/



Reply
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
How do I prevent users from changing macros? linto Excel Discussion (Misc queries) 1 January 6th 10 01:45 PM
Prevent users from changing the password roel1973 Excel Discussion (Misc queries) 1 April 5th 06 01:21 PM
Prevent wandering users cindee Excel Discussion (Misc queries) 2 October 5th 05 08:20 PM
prevent users from overwriting other users data [email protected] Excel Worksheet Functions 0 April 17th 05 08:18 PM
Prevent users from using AutoFilter Rob Savage Excel Programming 1 October 27th 03 11:42 AM


All times are GMT +1. The time now is 10:05 AM.

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

About Us

"It's about Microsoft Excel"