Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I used the following formula to autosort data in a column with good results:
Private Sub Worksheet_Change(ByVal Target As Range) Range("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End Sub The problem is that when I protect the sheet, I get the following error: runtime error '1004': Sort message of Range class failed whereupon it gives me the option to debug. The cells in this particular column are not protected. How do I fix this? Thanks in advance for your help. |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Two solutions, one of which should work:
1) When you protect the sheet, there is a list of things you can allow the user to do, with checkboxes. Try ticking the "Sort" check box. This might work in itself. 2) If the above does not work, then add the following lines to your code: Private Sub Worksheet_Change(ByVal Target As Range) ActiveSheet.Unprotect (password) Range("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1,MatchCase:=False, Orientation:=xlTopToBottom Activesheet.Protect (password) End Sub "Montana" wrote: I used the following formula to autosort data in a column with good results: Private Sub Worksheet_Change(ByVal Target As Range) Range("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End Sub The problem is that when I protect the sheet, I get the following error: runtime error '1004': Sort message of Range class failed whereupon it gives me the option to debug. The cells in this particular column are not protected. How do I fix this? Thanks in advance for your help. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
The first solution worked like a charm. Thanks again.
"Dom_Ciccone" wrote: Two solutions, one of which should work: 1) When you protect the sheet, there is a list of things you can allow the user to do, with checkboxes. Try ticking the "Sort" check box. This might work in itself. 2) If the above does not work, then add the following lines to your code: Private Sub Worksheet_Change(ByVal Target As Range) ActiveSheet.Unprotect (password) Range("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1,MatchCase:=False, Orientation:=xlTopToBottom Activesheet.Protect (password) End Sub "Montana" wrote: I used the following formula to autosort data in a column with good results: Private Sub Worksheet_Change(ByVal Target As Range) Range("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End Sub The problem is that when I protect the sheet, I get the following error: runtime error '1004': Sort message of Range class failed whereupon it gives me the option to debug. The cells in this particular column are not protected. How do I fix this? Thanks in advance for your help. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
You're welcome and thank you for letting me know.
"Montana" wrote: The first solution worked like a charm. Thanks again. "Dom_Ciccone" wrote: Two solutions, one of which should work: 1) When you protect the sheet, there is a list of things you can allow the user to do, with checkboxes. Try ticking the "Sort" check box. This might work in itself. 2) If the above does not work, then add the following lines to your code: Private Sub Worksheet_Change(ByVal Target As Range) ActiveSheet.Unprotect (password) Range("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1,MatchCase:=False, Orientation:=xlTopToBottom Activesheet.Protect (password) End Sub "Montana" wrote: I used the following formula to autosort data in a column with good results: Private Sub Worksheet_Change(ByVal Target As Range) Range("A:A").Sort Key1:=Range("A1"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom End Sub The problem is that when I protect the sheet, I get the following error: runtime error '1004': Sort message of Range class failed whereupon it gives me the option to debug. The cells in this particular column are not protected. How do I fix this? Thanks in advance for your help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
protecting a sheet yet allowing for sorting, filtering, formatting | Excel Discussion (Misc queries) | |||
Protecting Sheet and still allowing for sorting, filtering and formatting | Excel Discussion (Misc queries) | |||
Problem created by sorting linked sheet | Excel Discussion (Misc queries) | |||
How do I lock the Column without Protecting the Sheet | Excel Discussion (Misc queries) | |||
Realtime Automatic sorting of data in rows in new work sheet | Excel Worksheet Functions |