ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modify to only work with nominated range instead of entire sheet (https://www.excelbanter.com/excel-programming/418731-modify-only-work-nominated-range-instead-entire-sheet.html)

Corey

Modify to only work with nominated range instead of entire sheet
 
~~~~~~~~~~~~~~~~~~~~~~~
Dim c As Range
For Each c In Sheets("REPORT").UsedRange
If c.Locked = False Then c.Value = ""
Next c
End If
~~~~~~~~~~~~~~~~~~~~~~
The above code clears all cells in a sheet(REPORT) that are Not Locked.
However it seem to take a while to process.

How could i add a line to ONLY refer to a range of ( A1:AC960) instead of
the entire sheet ?


--
Corey ....
The Silliest Question is generally
the one i forgot to ask.



Jim Cone[_2_]

Modify to only work with nominated range instead of entire sheet
 

Note: the "UsedRange" is not the entire sheet.
'--
Sub SetThemFree()
On Error GoTo ViolatedParole
Dim c As Range
Application.ScreenUpdating = False
Application.Calculation = xlManual
For Each c In Sheets("REPORT").Range("A1:AC960").Cells
If c.Locked = False Then c.Value = vbNullString
Next 'c
ViolatedParole:
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
End Sub
--
Jim Cone
Portland, Oregon USA


"Corey"
wrote in message
~~~~~~~~~~~~~~~~~~~~~~~
Dim c As Range
For Each c In Sheets("REPORT").UsedRange
If c.Locked = False Then c.Value = ""
Next c
End If
~~~~~~~~~~~~~~~~~~~~~~
The above code clears all cells in a sheet(REPORT) that are Not Locked.
However it seem to take a while to process.

How could i add a line to ONLY refer to a range of ( A1:AC960) instead of
the entire sheet ?


--
Corey ....
The Silliest Question is generally
the one i forgot to ask.




All times are GMT +1. The time now is 03:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com