help needed sorry I hit enter on the last one

P

Postal Bob

I have a spreadsheet or workbook ( which ever you prefer) that I use daily.
It is quite extensive and has manty cells and rows of cells that I enter data
in. ther is 4 times that may cells that contain formulas. I fill this out
each day for the week and then print and submit it. After I print it I have
to go to each cell and /or row of cells and delete the data. My question is,
is there a way to format a cell with a command to delete all data in
unprotected cells?
 
T

Tom Hutchins

You could use a macro to delete all data in unprotected cells...

Sub Clearem()
Dim c As Range
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then
c.ClearContents
End If
Next
End Sub

Paste the code in a VBA module in your workbook. Run it from your worksheet
by selecting Tools >> Macro >> Macros >> Clearem >> Run.

If you are new to macros, this link to Jon Peltier's site may be helpful:
http://peltiertech.com/WordPress/2008/03/09/how-to-use-someone-elses-macro/

Hope this helps,

Hutch
 
G

Gord Dibben

You could try F5>Special>Constants to select all but Formulas>OK

Edit>Clear Contents

Note: you state workbook so you would have to do this for each worksheet in
that workbook.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top