![]() |
Error in Macro 2003
Hi
I have recorded a macro to define certain columns that a user can edit within a range of a protected worksheet,, but the line keeps giving me an error at the protection line (marked below with an asterisk) - Runtime error '1004' Application-defined or object-defined error My Macro looks like this... ' editranges Macro Sheets("Rep 1").Select Range("A1").Select *** ActiveSheet.Protection.alloweditranges.Add Title:="editranges", Range:= _ Range("E:E,G:G,K:K,M:M,O:O,Q:Q,S:S,T:T") ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowSorting:= _ True, AllowFiltering:=True ActiveSheet.EnableSelection = xlNoRestrictions Range("A1").Select End Sub Thanks in advance |
Error in Macro 2003
Lisa,
You can probably simplify things a bit, try this:- Sub stance() Sheets("Rep 1").Select ActiveSheet.Unprotect Range("E:E,G:G,K:K,M:M,O:O,Q:Q,S:S,T:T").Select Selection.Locked = False ActiveSheet.Protect Range("E1").Select End Sub Mike "Lisa" wrote: Hi I have recorded a macro to define certain columns that a user can edit within a range of a protected worksheet,, but the line keeps giving me an error at the protection line (marked below with an asterisk) - Runtime error '1004' Application-defined or object-defined error My Macro looks like this... ' editranges Macro Sheets("Rep 1").Select Range("A1").Select *** ActiveSheet.Protection.alloweditranges.Add Title:="editranges", Range:= _ Range("E:E,G:G,K:K,M:M,O:O,Q:Q,S:S,T:T") ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowSorting:= _ True, AllowFiltering:=True ActiveSheet.EnableSelection = xlNoRestrictions Range("A1").Select End Sub Thanks in advance |
All times are GMT +1. The time now is 01:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com