View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Clearing data from a so called protected sheet???

Since your code is in a sheet module, unqualified references to ranges refer
to that sheet - not the activesheet, so you are not refering to sheets "1",
"2", or "3", but to the sheet containing the code (which I assume remains
protected).

'Clear the sheets that have data
Sheets("1").Select
Range("F9:k28").ClearContents :) :) :) :) :) :)
Sheets("2").Select
Range("F9:K28").Select
Selection.ClearContents
Sheets("LCIS").Select
Range("3").Select
Selection.ClearContents
Sheets("menu").Select
Range("a1").Activate

should be

'Clear the sheets that have data
Sheets("1").Range("F9:k28").ClearContents
Sheets("2").Range("F9:K28").ClearContents
' the next line seems strange since you unprotected worksheets("3")
Sheets("LCIS").Range("3").ClearContents
Sheets("menu").select
Sheets("menu").Range("a1").Select

--
Regards,
Tom Ogilvy

"funkymonkUK" wrote:


It is the only file I have open when it unprotects. I have checked by
stepping through the code the page is protected before I start the code
and as I step through each sheet is unprotected.


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=542818