Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
JoeBed
 
Posts: n/a
Default Clear all uprotected data?


Is there a way to clear all of the data you have entered on a
spreadsheet that is entered in the unprotected cells all at once?


--
JoeBed
------------------------------------------------------------------------
JoeBed's Profile: http://www.excelforum.com/member.php...o&userid=21368
View this thread: http://www.excelforum.com/showthread...hreadid=380317

  #2   Report Post  
Damon Longworth
 
Posts: n/a
Default

Here is a routine to clear all unprotected cells:

Dim MyCell As Object

'clears all data from each unlocked cell

For Each MyCell In ActiveSheet.UsedRange

If MyCell.Locked = False Then

MyCell.ClearContents

End If

Next

"JoeBed" wrote in
message ...

Is there a way to clear all of the data you have entered on a
spreadsheet that is entered in the unprotected cells all at once?


--
JoeBed
------------------------------------------------------------------------
JoeBed's Profile:
http://www.excelforum.com/member.php...o&userid=21368
View this thread: http://www.excelforum.com/showthread...hreadid=380317



  #3   Report Post  
JoeBed
 
Posts: n/a
Default


Damon,
Thanks for responding to my question. I don't understand what you are
saying. What is (Dim my cell as Object)? Is that part of the formula?
What would the formula look like?
JoeBed


--
JoeBed
------------------------------------------------------------------------
JoeBed's Profile: http://www.excelforum.com/member.php...o&userid=21368
View this thread: http://www.excelforum.com/showthread...hreadid=380317

  #4   Report Post  
anilsolipuram
 
Posts: n/a
Default


That is macro that Damon pasted

go to tools-macro-visual basic editor, insert module, paste the below
code in the module, close the visual basic eidtor

go to tools-macro-macros-select "test_macro" and click run, it
should work now.


sub test_macro()
Dim MyCell As Object

'clears all data from each unlocked cell

For Each MyCell In ActiveSheet.UsedRange

If MyCell.Locked = False Then

MyCell.ClearContents

End If

Next
end sub


--
anilsolipuram
------------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271
View this thread: http://www.excelforum.com/showthread...hreadid=380317

  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

Just to add to anilsolipuram's post.

If you've never writtin a macro before, you may want to look at David
McRitchie's site:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

=========
Another non-macro approach.

Give that range of cells that should be cleared a nice name.

Select the first cell and ctrl-click on subsequent cells.

Then Insert|Name|Define

Then when you want to clear those cells, you can hit Edit|Goto, type in that
name you created (hit enter) and then hit the delete key on the keyboard.

JoeBed wrote:

Damon,
Thanks for responding to my question. I don't understand what you are
saying. What is (Dim my cell as Object)? Is that part of the formula?
What would the formula look like?
JoeBed

--
JoeBed
------------------------------------------------------------------------
JoeBed's Profile: http://www.excelforum.com/member.php...o&userid=21368
View this thread: http://www.excelforum.com/showthread...hreadid=380317


--

Dave Peterson


  #6   Report Post  
JoeBed
 
Posts: n/a
Default


Anilsolipuram

I can get your Macro to work in a simple excell test but when I try it
in mine The test pops up (Cannot change part of a merged cell). The
Debug points at (MyCell.ClearContents) I have a lot of merged cells!
Any suggestions? Thanks for you help.
JoeBed


--
JoeBed
------------------------------------------------------------------------
JoeBed's Profile: http://www.excelforum.com/member.php...o&userid=21368
View this thread: http://www.excelforum.com/showthread...hreadid=380317

  #7   Report Post  
Dave Peterson
 
Posts: n/a
Default

change
MyCell.ClearContents
to
MyCell.value = ""



JoeBed wrote:

Anilsolipuram

I can get your Macro to work in a simple excell test but when I try it
in mine The test pops up (Cannot change part of a merged cell). The
Debug points at (MyCell.ClearContents) I have a lot of merged cells!
Any suggestions? Thanks for you help.
JoeBed

--
JoeBed
------------------------------------------------------------------------
JoeBed's Profile: http://www.excelforum.com/member.php...o&userid=21368
View this thread: http://www.excelforum.com/showthread...hreadid=380317


--

Dave Peterson
  #8   Report Post  
JoeBed
 
Posts: n/a
Default


anilsolipuram,

Thank you for your help. It works fine now.

JoeBed


--
JoeBed
------------------------------------------------------------------------
JoeBed's Profile: http://www.excelforum.com/member.php...o&userid=21368
View this thread: http://www.excelforum.com/showthread...hreadid=380317

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
Import Data Keeps asking for Password Dominator Excel Discussion (Misc queries) 0 June 5th 05 11:25 PM
Sort pages? David Excel Discussion (Misc queries) 15 May 13th 05 11:33 PM
Problem with external data baz Excel Discussion (Misc queries) 0 March 31st 05 10:47 AM
Running Data Table using an input that triggers DDE linked data [email protected] Excel Discussion (Misc queries) 1 December 16th 04 11:56 AM
Data Table - does it work with DDE links and Stock Tickers? Post Tenebras Lux Excel Worksheet Functions 0 December 1st 04 05:17 PM


All times are GMT +1. The time now is 11:44 PM.

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"