ExcelBanter

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

shishi

Is there any way we can 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


Toppers

Is there any way we can clear everything..
 
Hi,
This worked for me (Xl2003) to clear columns A to C where
Range("Start") is first named cell in Column A :

Range(Range("Start"), Cells(Cells(Rows.Count, "C").End(xlUp).Row, "C")).Clear


"shishi" wrote:

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 can 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




shishi

Is there any way we can clear everything..
 
Thank you Tom. It really worked.

shishi



All times are GMT +1. The time now is 05:55 PM.

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