Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default worksheet protection

It is an example to lock/unlock cells with formulas.

Sub LockCellsWithFormulas(passwd As String, Optional bLock As Boolean =
True)
Dim c As Object

ActiveSheet.Unprotect Password:=passwd
For Each c In ActiveSheet.UsedRange.Cells 'only in used range. If exist
more than 1 UsedRange then macro locks/unlocks only cells in first used
range
' For Each c In ActiveSheet.Cells 'in all worksheet
If c.Formula Like "=*" Then
c.Select
Selection.Locked = bLock
Selection.FormulaHidden = bLock
End If
Next c

If passwd < "" Then _
ActiveSheet.Protect Password:=passwd, DrawingObjects:=True, Contents:=True,
Scenarios:=True

End Sub


Uzytkownik "Todd" napisal w wiadomosci
...
Is there a way to select all cells without a formula and
unlock them? Maybe a macro? I want to protect all the
cells with formulas and leave the rest open to changes.
Right now all cells with data are locked. I have a lot
of worksheets so doing this manually will take a LONG time.


TIA

Todd



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
Worksheet Protection James8309 Excel Worksheet Functions 1 June 5th 08 07:05 PM
Worksheet protection adehart Excel Worksheet Functions 1 October 16th 06 02:57 PM
Cell Protection vs. Worksheet Protection kmwhitt Excel Discussion (Misc queries) 4 September 24th 06 02:37 AM
Worksheet protection is gone and only wokbook protection can be se Eric C. Excel Discussion (Misc queries) 4 May 2nd 06 04:50 PM
Worksheet Protection PA New Users to Excel 3 August 20th 05 02:32 PM


All times are GMT +1. The time now is 10:33 PM.

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"