ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting Many Cells on a Sheet (https://www.excelbanter.com/excel-programming/281048-deleting-many-cells-sheet.html)

Jim[_34_]

Deleting Many Cells on a Sheet
 
I am using Excel 2002 and have a sheet which Ranges from E5:O78.
There are 20 ranges like E5:F18, H5:F18 etc which has only input info as in
a time sheet.
I need to delete the info with a macro but need to keep the Formulas outside
these Ranges
intact. I have been successfully using:
ActiveSheet.Unprotect
Range("E5:F18,H5:I18,K5:L18,etc................... .).ClearContents
ActiveSheet.Protect
but the formula length become unwieldy with 20 Ranges to clear, is there one
Formula which
will only delete non formula cells?
Many thanks
Jim



Ron de Bruin

Deleting Many Cells on a Sheet
 
Select the range E5:L18 for example
Press F5
click on special
choose constants
press the delete key

Or with VBA

Range("E5:L18").SpecialCells(xlCellTypeConstants). ClearContents



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Jim" wrote in message .. .
I am using Excel 2002 and have a sheet which Ranges from E5:O78.
There are 20 ranges like E5:F18, H5:F18 etc which has only input info as in
a time sheet.
I need to delete the info with a macro but need to keep the Formulas outside
these Ranges
intact. I have been successfully using:
ActiveSheet.Unprotect
Range("E5:F18,H5:I18,K5:L18,etc................... .).ClearContents
ActiveSheet.Protect
but the formula length become unwieldy with 20 Ranges to clear, is there one
Formula which
will only delete non formula cells?
Many thanks
Jim





Jim[_34_]

Deleting Many Cells on a Sheet
 
Many thanks Ron, much easier!!


"Ron de Bruin" wrote in message
...
Select the range E5:L18 for example
Press F5
click on special
choose constants
press the delete key

Or with VBA

Range("E5:L18").SpecialCells(xlCellTypeConstants). ClearContents



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Jim" wrote in message

.. .
I am using Excel 2002 and have a sheet which Ranges from E5:O78.
There are 20 ranges like E5:F18, H5:F18 etc which has only input info as

in
a time sheet.
I need to delete the info with a macro but need to keep the Formulas

outside
these Ranges
intact. I have been successfully using:
ActiveSheet.Unprotect
Range("E5:F18,H5:I18,K5:L18,etc................... .).ClearContents
ActiveSheet.Protect
but the formula length become unwieldy with 20 Ranges to clear, is there

one
Formula which
will only delete non formula cells?
Many thanks
Jim








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

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