Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Zadig Galbaras
 
Posts: n/a
Default Marking unlocked cells in active worksheet

Hi u all!

I have a rather large spreadsheet taking care of our soccer betting club,
and I need to clear the contains of every cell that is not locked when the
spreadsheet is locked.

Is this possible?

I tried this simple function in the EDIT/GOTO...but it seems not to do the
job.
May be I use it wrong, but I couldn't make it work. I tried all
possibilities there I guess.



--

Regards
Zadig Galbaras
A Perturbed Norwegian Agnostic
-----



  #2   Report Post  
Paul B
 
Posts: n/a
Default

Zadig, here is one way with a macro

Sub Delete_Unlocked_Cells()
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


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Zadig Galbaras" wrote in message
...
Hi u all!

I have a rather large spreadsheet taking care of our soccer betting club,
and I need to clear the contains of every cell that is not locked when the
spreadsheet is locked.

Is this possible?

I tried this simple function in the EDIT/GOTO...but it seems not to do the
job.
May be I use it wrong, but I couldn't make it work. I tried all
possibilities there I guess.



--

Regards
Zadig Galbaras
A Perturbed Norwegian Agnostic
-----





  #3   Report Post  
dominicb
 
Posts: n/a
Default


Good evening Zadig Galbaras

The code below will select all unlocked cells in a given range, making
it very easy for you to clear - just press delete. However this will
not work with the spreadsheet protected. An easy way around this would
be to make the first line unprotect the sheet and the last line protect
it again. I don't know how you have protected your sheet (ie password,
other settings) so I can only give a little guidance on these commands,
but at their most basic would be:

ActiveSheet.Unprotect

and

ActiveSheet.Protect

Sub Macro1()
Count = 0
On Error Resume Next
For Each rng In Selection
If rng.Locked = False Then
Count = Count + 1
If Count = 1 Then Set Unlocked = rng
If Count < 1 Then Set Unlocked = Union(Unlocked, rng)
End If
Next rng
Unlocked.Select
End Sub

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=395497

  #4   Report Post  
Zadig Galbaras
 
Posts: n/a
Default

Hi Paul & Dominic

Worked as a charm.

Thank you to you both!

--

Regards
Zadig Galbaras
A Perturbed Norwegian Agnostic
-----


"Zadig Galbaras" skrev i melding
...
Hi u all!

I have a rather large spreadsheet taking care of our soccer betting club,
and I need to clear the contains of every cell that is not locked when the
spreadsheet is locked.

Is this possible?

I tried this simple function in the EDIT/GOTO...but it seems not to do the
job.
May be I use it wrong, but I couldn't make it work. I tried all
possibilities there I guess.



--

Regards
Zadig Galbaras
A Perturbed Norwegian Agnostic
-----





  #5   Report Post  
Paul B
 
Posts: n/a
Default

Your Welcome

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Zadig Galbaras" wrote in message
...
Hi Paul & Dominic

Worked as a charm.

Thank you to you both!

--

Regards
Zadig Galbaras
A Perturbed Norwegian Agnostic
-----


"Zadig Galbaras" skrev i melding
...
Hi u all!

I have a rather large spreadsheet taking care of our soccer betting

club,
and I need to clear the contains of every cell that is not locked when

the
spreadsheet is locked.

Is this possible?

I tried this simple function in the EDIT/GOTO...but it seems not to do

the
job.
May be I use it wrong, but I couldn't make it work. I tried all
possibilities there I guess.



--

Regards
Zadig Galbaras
A Perturbed Norwegian Agnostic
-----







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
Can specific cells on a worksheet be hidden & password protected? Ann Excel Worksheet Functions 6 July 5th 05 09:08 PM
move between unlocked cells on protected sheet ayanna Excel Discussion (Misc queries) 1 April 27th 05 05:59 PM
Problem trying to move between cells on a protected worksheet. ayanna Excel Discussion (Misc queries) 0 April 26th 05 09:18 PM
automatically PRINT only active cells? eab Excel Discussion (Misc queries) 1 April 5th 05 07:01 PM
How can I merge unlocked cells in a worksheet that has been protec NeedMergeHelp Excel Discussion (Misc queries) 2 December 7th 04 01:20 AM


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