#1   Report Post  
 
Posts: n/a
Default Excel protection

I want to protect some cells in a sheet so that I can just select and
blank the whole sheet while keeping the formulas in some cells intact.
The problem is that, having unlocked the editable cells and protected
the worksheet, when I then select the entire sheet it won't let me just
blank the unlocked cells - it tells me that some cells are protected.
Can anyone please help.

  #2   Report Post  
Gord Dibben
 
Posts: n/a
Default

If you want to keep ALL formulas and clear everything else......

Leave the sheet unprotected then select all cells and F5SpecialConstants.
Check or uncheck what you want to clear then OK.

With those cells selected, EditClearContents will leave formulas intact.

If just some specific cells you could leave the sheet protected and use a
macro to select only those that are unlocked and clear contents of those.

Sub UnLocked_Cells()
Dim Cell As Range, tempR As Range, rangeToCheck As Range
Cells.Select
For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
If Not Cell.Locked Then
If tempR Is Nothing Then
Set tempR = Cell
Else
Set tempR = Union(tempR, Cell)
End If
End If
Next Cell
If tempR Is Nothing Then
MsgBox "There are no UnLocked cells in " & _
"the selected range."
End
End If
tempR.Select
tempR.ClearContents
End Sub


Gord Dibben Excel MVP

On 17 Feb 2005 07:07:25 -0800, wrote:

I want to protect some cells in a sheet so that I can just select and
blank the whole sheet while keeping the formulas in some cells intact.
The problem is that, having unlocked the editable cells and protected
the worksheet, when I then select the entire sheet it won't let me just
blank the unlocked cells - it tells me that some cells are protected.
Can anyone please help.


  #3   Report Post  
Gord Dibben
 
Posts: n/a
Default

Another macro for clearing contents of unlocked cells.

Little less code.

Sub DeleteUnlockedCells()
Dim rngeCell As Range
Application.ScreenUpdating = False
For Each rngeCell In ActiveSheet.UsedRange.Cells
If rngeCell.Locked = False Then rngeCell.ClearContents
Next
Application.ScreenUpdating = True
End Sub


Gord

On 17 Feb 2005 07:07:25 -0800, wrote:

I want to protect some cells in a sheet so that I can just select and
blank the whole sheet while keeping the formulas in some cells intact.
The problem is that, having unlocked the editable cells and protected
the worksheet, when I then select the entire sheet it won't let me just
blank the unlocked cells - it tells me that some cells are protected.
Can anyone please help.


  #4   Report Post  
Kev Nurse
 
Posts: n/a
Default


wrote in message
ups.com...
I want to protect some cells in a sheet so that I can just select and
blank the whole sheet while keeping the formulas in some cells intact.
The problem is that, having unlocked the editable cells and protected
the worksheet, when I then select the entire sheet it won't let me just
blank the unlocked cells - it tells me that some cells are protected.
Can anyone please help.


Have you thought about recording a macro?


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
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
Excel on XP: Password Protection Rich Hayes Excel Discussion (Misc queries) 1 February 4th 05 10:47 PM
Difference in number of Excel NewsGroups Hari Prasadh Excel Discussion (Misc queries) 1 January 25th 05 11:32 AM
protection on excel forms cben Excel Worksheet Functions 1 December 14th 04 02:23 PM
Protection in Excel via email kalz Excel Worksheet Functions 0 December 13th 04 12:47 AM


All times are GMT +1. The time now is 06:48 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"