ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there any way we cna clear everything.. (https://www.excelbanter.com/excel-programming/336936-there-any-way-we-cna-clear-everything.html)

shishi

Is there any way we cna clear everything..
 
Hi all,

I am writing a code that can clear everything starting from a named
cell to the end of the sheet. The situation like this..

----------
| START_1 | <---Named cell
----------
Table 1 goes here

----------
| START_2 | <---Named cell
----------
Table 2 goes here .. and so on.

I wish to clear everything from START_1 to the end of the sheet. I
need to clear even the named cells. I tried a recorded macro to clear
all. But that doesn't clear the named cells. Any ideas or
suggestions...Thanks in advance for your advice..

Shishi


Tom Ogilvy

Is there any way we cna clear everything..
 
Dim rng as Range
set rng = Range(range("Start_1").Row & ":65536")EntireRow.Delete
On Error Resume Next
for each nm in ActiveWorkbook.Names
if Instr(1,nm.Refersto,"#Ref",vbTextCompare) then
nm.Delete
end if
Next
On Error goto 0

--
Regards,
Tom Ogilvy

"shishi" wrote in message
oups.com...
Hi all,

I am writing a code that can clear everything starting from a named
cell to the end of the sheet. The situation like this..

----------
| START_1 | <---Named cell
----------
Table 1 goes here

----------
| START_2 | <---Named cell
----------
Table 2 goes here .. and so on.

I wish to clear everything from START_1 to the end of the sheet. I
need to clear even the named cells. I tried a recorded macro to clear
all. But that doesn't clear the named cells. Any ideas or
suggestions...Thanks in advance for your advice..

Shishi





All times are GMT +1. The time now is 06:34 AM.

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