View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default need help please....

First bit

Sub ClearCells()
Dim sh As Worksheet
Dim cell As Range

For Each sh In ActiveWorkbook.Worksheets
sh.Unprotect
For Each cell In sh.UsedRange
If Not cell.Locked Then
cell.ClearContents
End If
Next cell
sh.Protect
Next sh

End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Psycho0426" wrote
in message ...

I have a problem that I can't seem to solve. I'm trying to create a
macro, or find some othe way of automating the unprotecting the
worksheet, clearing of all non-protected cells on the worksheet,
re-protect the worksheet with no password, and move on to the next
worksheet in the file and do it again to the end. The file (workbook?)
is 32 worksheets long, 1 for every day & 1 for monthly totals. My
attempts to record a macro have blown up in my face miserably. They
refuse to process more than one page even when I select them all. I'm
sure excel can do this, but I'm self-taught so there's a lot I don't
know how to do yet. I'm using excel 2003.

Also, on a different worksheet I'm trying to find a way to sort
entire rows based on customers names. Example:


Account # Last MI First
----------------------------
xxxxxxxxxx Public Q John
xxxxxxxxxx Blow B Joe
xxxxxxxxxx Doe A Jane

*******************Sort To************************

Account # Last MI First
----------------------------
xxxxxxxxxx Blow B Joe
xxxxxxxxxx Doe A Jane
xxxxxxxxxx Public Q John

I would like to sort based on last name, then first name, then MI,
but I can't find a way to keep the entire row together. Anyone have any
ideas??? I don't have a clue how to do this. Thank you for any
assistance.


--
Psycho0426


------------------------------------------------------------------------
Psycho0426's Profile:

http://www.excelforum.com/member.php...o&userid=32832
View this thread: http://www.excelforum.com/showthread...hreadid=526317