Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 102
Default Macro & Protected sheet

Hello everyone

I have a sheet which is protected so that cells cannot be changed and
formulas are hidden which works well. However I also have a macro on this
sheet which I still want people to be able to use. (see below) I have seen
some answers already but seem to be doing something wrong - what do I need to
add to the below to have the macro only run but keep the actual cells
locked/protected?

Many thanks

Sub Sort()
'
' Sort Macro
' Macro recorded 17/03/2010 by Lisa Senior
'
' Keyboard Shortcut: Ctrl+o
'

Columns("A:A").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub
--
Thanks as always

Lise
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default Macro & Protected sheet

Hi Lisa,

Paste the code below in a standard module

---------------
Sub Sort_pr_range()
ActiveSheet.Unprotect 'Unprotect the sheet
Range("A1:F100").Sort Key1:=Range("B1"), _ '("A1:F100")would be your range
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
ActiveSheet.Protect 'Protect the sheet
End Sub

---------------

Hope it works for you

--

Thank you and Regards

Garreth Lombard


"Lise" wrote:

Hello everyone

I have a sheet which is protected so that cells cannot be changed and
formulas are hidden which works well. However I also have a macro on this
sheet which I still want people to be able to use. (see below) I have seen
some answers already but seem to be doing something wrong - what do I need to
add to the below to have the macro only run but keep the actual cells
locked/protected?

Many thanks

Sub Sort()
'
' Sort Macro
' Macro recorded 17/03/2010 by Lisa Senior
'
' Keyboard Shortcut: Ctrl+o
'

Columns("A:A").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub
--
Thanks as always

Lise

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 102
Default Macro & Protected sheet

Sorry Gareth I must have missed a step as this still gives me the bug alert.

I kept my CTRLO macro alive and added a module with your info below
--

Any assistance would be great

Thanks as always

Lise


"Garreth Lombard" wrote:

Hi Lisa,

Paste the code below in a standard module

---------------
Sub Sort_pr_range()
ActiveSheet.Unprotect 'Unprotect the sheet
Range("A1:F100").Sort Key1:=Range("B1"), _ '("A1:F100")would be your range
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
ActiveSheet.Protect 'Protect the sheet
End Sub

---------------

Hope it works for you

--

Thank you and Regards

Garreth Lombard


"Lise" wrote:

Hello everyone

I have a sheet which is protected so that cells cannot be changed and
formulas are hidden which works well. However I also have a macro on this
sheet which I still want people to be able to use. (see below) I have seen
some answers already but seem to be doing something wrong - what do I need to
add to the below to have the macro only run but keep the actual cells
locked/protected?

Many thanks

Sub Sort()
'
' Sort Macro
' Macro recorded 17/03/2010 by Lisa Senior
'
' Keyboard Shortcut: Ctrl+o
'

Columns("A:A").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub
--
Thanks as always

Lise

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
Macro functions in a protected sheet Keyrookie New Users to Excel 4 December 9th 09 06:59 PM
Macro Error when Sheet is Protected Johnny Excel Discussion (Misc queries) 4 July 28th 06 08:43 PM
macro on protected sheet-error michaelberrier Excel Discussion (Misc queries) 6 June 11th 06 07:31 PM
use macro button to run macro in protected sheet earl Excel Discussion (Misc queries) 3 February 26th 06 11:21 PM
Macro Errs when sheet is protected Skankles Excel Worksheet Functions 1 February 10th 05 07:44 PM


All times are GMT +1. The time now is 03:19 AM.

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"