Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete rows foward if cell is empty


I have a sheet that once cell "A" is blank, I want that row
and all the rows forward to be deleted. How can this be done?


Thanks,
Me

--
Metraza
-----------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...fo&userid=3164
View this thread: http://www.excelforum.com/showthread.php?threadid=51618

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete rows foward if cell is empty

How does cell A become blank? What does cell "A" mean?

--
Regards,
Tom Ogilvy

"Metrazal" wrote in
message ...

I have a sheet that once cell "A" is blank, I want that row
and all the rows forward to be deleted. How can this be done?


Thanks,
Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile:

http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=516182



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete rows foward if cell is empty


What I am looking for is a way to delete all the rows forward once the
first row in column A is empty. Sorry
for my Misuse of the English.

Thanks,
Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=516182

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete rows foward if cell is empty

right click on the sheet tab and select view code. paste in code like this

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On error goto errhandler
if len(trim(Range("A1").Value) = 0 then
Application.EnableEvents = False
rows.delete
end if
ErrHandler:
Application.EnableEvents = True
End Sub

If you are not familiar with events, see Chip Pearson's page on events
http://www.cpearson.com/excel/events.htme

--
Regards,
Tom Ogilvy



"Metrazal" wrote in
message ...

What I am looking for is a way to delete all the rows forward once the
first row in column A is empty. Sorry
for my Misuse of the English.

Thanks,
Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile:

http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=516182



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete rows foward if cell is empty


I get a compile error with this code on the if statement. What is len?
Length? I don't know.. Anyway, I could not get this code to work.

Any help?

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=516182



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete rows foward if cell is empty

It was a last minute change to be a bit more robust since I don't have any
knowledge of your sheet. I left off a closing parenthesis. Len checks the
length of the entry in the cell. this should work even if it looks blank.



Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On error goto errhandler
if len(trim(Range("A1").Value)) = 0 then
Application.EnableEvents = False
rows.delete
end if
ErrHandler:
Application.EnableEvents = True
End Sub


--
Regards,
Tom Ogilvy

"Metrazal" wrote in
message ...

I get a compile error with this code on the if statement. What is len?
Length? I don't know.. Anyway, I could not get this code to work.

Any help?

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile:

http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=516182



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hpw do I delete multiple empty rows found between filled rows? Bill Excel Worksheet Functions 2 November 15th 09 07:12 PM
Delete Empty Rows JCG Excel Discussion (Misc queries) 4 December 18th 07 11:31 AM
How to Delete empty rows in excel in b/w rows with values Dennis Excel Worksheet Functions 3 August 28th 07 04:15 PM
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows Scott Excel Worksheet Functions 0 December 13th 06 01:25 AM
Delete empty rows with cell type 2 FrankNL Excel Discussion (Misc queries) 1 May 3rd 06 11:10 AM


All times are GMT +1. The time now is 08:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"