![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Dog Beach, Florida. Yeaahh!
Posts: 4,038
|
When I go from one fiscal year to the next, I have to erase all the unprotected data I've input to clear the cells for the new year. There can be dozens of unprotected ranges throughout the spreadsheet, and I have dozens of yearly workbooks.
I can't highlight the entire sheet and erase, because most of the cells are protected. Is there a macro to designate only the unprotected cells and erase them in one swell foop? Thanx in advanx.
__________________
Barry- Photo Restoration/Enhancement http://www.smiledogproductions.com click below for detour
|
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Yes sir, try the following:
Code:
Sub clr() Dim cl As Range For Each cl In ActiveSheet.UsedRange If Not cl.Locked Then cl.ClearContents Next cl End Sub |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|