Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could give this routine a try; it will clear all unlocked cells on all
worksheets in the active workbook (and it should be pretty fast)... Sub ClearUnlockedCells() Dim C As Range, FoundCells As Range, SheetName As String Dim WS As Worksheet, FirstAddress As String Application.ScreenUpdating = False Application.FindFormat.Locked = False SheetName = ActiveSheet.Name For Each WS In Worksheets WS.Activate Set FoundCells = Nothing With WS.UsedRange Set C = .Find("", SearchFormat:=True) If Not C Is Nothing Then FirstAddress = C.Address Do If FoundCells Is Nothing Then Set FoundCells = C Else Set FoundCells = Union(FoundCells, C) End If Set C = .Find("", after:=C, SearchFormat:=True) Loop While Not C Is Nothing And C.Address < FirstAddress End If If Not FoundCells Is Nothing Then FoundCells.Clear End With Next Application.FindFormat.Clear Worksheets(SheetName).Activate Application.ScreenUpdating = True End Sub -- Rick (MVP - Excel) "Glenn" wrote in message ... Hi, I would like a bit of VB code that when clicked will clear all unprotected fields within a workbook. Many thanks, Glenn |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to sort (by one field), copy (based on one field) to another tab,then clear data on original sheet. | Excel Programming | |||
CLEAR FIELD TEXT ON CLICK? | Excel Programming | |||
How to clear content from unprotected Field | Excel Worksheet Functions | |||
How do I clear the Field pulldowns after the data is cleared? | Excel Discussion (Misc queries) | |||
how do i create a button to clear a value field i created? | Excel Programming |