Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Macro to delete rows

Hi Kirk,

Kirk P. wrote:
I was hoping to create a VBA function that would identify empty or blank cells within a range, and then delete the row
associated with that empty or blank cell.


try this:

Range("A1:A50").SpecialCells(xlCellTypeBlanks).Ent ireRow.Delete

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to delete rows

I like to add this

Use this instead to avoid a error when there are no blanks

Sub test()
On Error Resume Next
Range("A1:A50").SpecialCells(xlCellTypeBlanks).Ent ireRow.Delete
On Error GoTo 0
End Sub

Also this code can be a problem
Read this KB
http://support.microsoft.com/?kbid=832293


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Melanie Breden" wrote in message ...
Hi Kirk,

Kirk P. wrote:
I was hoping to create a VBA function that would identify empty or blank cells within a range, and then delete the row
associated with that empty or blank cell.


try this:

Range("A1:A50").SpecialCells(xlCellTypeBlanks).Ent ireRow.Delete

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Macro to delete rows

Ron de Bruin wrote:
I like to add this

Use this instead to avoid a error when there are no blanks

Sub test()
On Error Resume Next
Range("A1:A50").SpecialCells(xlCellTypeBlanks).Ent ireRow.Delete
On Error GoTo 0
End Sub


Ron thanks you for the addition :-)

--
Regards
Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)

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
Delete all Rows Macro Wanna Learn Excel Discussion (Misc queries) 5 March 6th 07 10:06 PM
delete rows-macro TUNGANA KURMA RAJU Excel Discussion (Misc queries) 5 January 13th 06 12:01 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Macro to Delete Rows Ed[_14_] Excel Programming 4 February 24th 04 06:42 PM
HOW TO: Delete Rows with a Macro Jase Excel Programming 0 September 11th 03 06:05 AM


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

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

About Us

"It's about Microsoft Excel"