#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default Clear cells

I have a range of cells selected... using macros how can I unprotect all
those in the range that do not have formulas on it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Clear cells

Hi

Try this:

Sub UnprotectCells()
ActiveSheet.Unprotect password:="JustMe"
For Each cell In Selection
If cell.HasFormula = False Then
cell.Locked = False
End If
Next
ActiveSheet.Protect password:="JustMe"
End Sub

Regards,
Per


On 19 Sep., 04:44, Alberto Ast
wrote:
I have a range of cells selected... using macros how can I unprotect all
those in the range that do not have formulas on it?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Clear cells

Try the below....

Me.Unprotect Password:="dist"
ActiveSheet.Cells.Locked = True
Selection.Locked = False
Selection.SpecialCells(xlCellTypeFormulas, 23).Select
Selection.Locked = True
Selection.FormulaHidden = True
Me.Protect Password:="dist"

If this post helps click Yes
---------------
Jacob Skaria


"Alberto Ast" wrote:

I have a range of cells selected... using macros how can I unprotect all
those in the range that do not have formulas on it?

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
Lookup cells in one column and clear cells in another JoshW0000 Excel Programming 5 September 3rd 09 03:01 PM
Create a Clear button to clear unprotected cells Jcraig713 Excel Programming 2 November 26th 07 03:55 PM
Clear cells Hitu Excel Programming 2 March 29th 06 05:00 PM
clear contents cells of unprotected cells Ed Excel Programming 6 January 12th 06 06:09 PM
Clear cells range if certain cells are all empty gschimek - ExcelForums.com Excel Programming 6 May 13th 05 10:38 PM


All times are GMT +1. The time now is 01:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"