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

I found a macro in the archives! But I am having trouble
running it. I get the message "unable to set locked
property of the range class". Where am I going wrong????
The debugger doesn't like the else: statement


Thanks again,

Todd



Sub ProtFormula()

Dim cell As Range
Dim sht As Worksheet

Application.ScreenUpdating = False
For Each sht In Worksheets
sht.Activate
For Each cell In sht.UsedRange
If cell.HasFormula = True Then
cell.Locked = True
cell.FormulaHidden = False
Else: cell.Locked = False
End If
Next cell
Next sht
Application.ScreenUpdating = True

End Sub


-----Original Message-----
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 Susan Excel Worksheet Functions 3 January 19th 08 01:10 AM
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 Angeline Excel Discussion (Misc queries) 3 March 20th 06 12:49 PM
protection of worksheet lbuck Excel Discussion (Misc queries) 0 January 12th 06 06:59 PM


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