Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Richard
 
Posts: n/a
Default Delete Row If Empty Macro

Using: MS OS XP
Excel 2003

I have tried and need some help for some VBA code in a macro.

I have a table of about 400 rows. The rows may vary but not be over 400. I
need to check the cells in column A. If the cell in column A is empty then I
want to delete the entire row and go and check the next cell in column A etc.

The rows may vary but they shouldnt exceed 400.



--
Richard
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Delete Row If Empty Macro

Select column A
Edit|goto|special
check Blanks

Edit|Delete|entire row.



Richard wrote:

Using: MS OS XP
Excel 2003

I have tried and need some help for some VBA code in a macro.

I have a table of about 400 rows. The rows may vary but not be over 400. I
need to check the cells in column A. If the cell in column A is empty then I
want to delete the entire row and go and check the next cell in column A etc.

The rows may vary but they shouldnt exceed 400.

--
Richard


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Delete Row If Empty Macro

And if you need a macro:

Option Explicit
Sub testme()
On Error Resume Next
ActiveSheet.Range("a:A").Cells.SpecialCells(xlCell TypeBlanks).EntireRow.Delete
On Error GoTo 0
End Sub


Dave Peterson wrote:

Select column A
Edit|goto|special
check Blanks

Edit|Delete|entire row.

Richard wrote:

Using: MS OS XP
Excel 2003

I have tried and need some help for some VBA code in a macro.

I have a table of about 400 rows. The rows may vary but not be over 400. I
need to check the cells in column A. If the cell in column A is empty then I
want to delete the entire row and go and check the next cell in column A etc.

The rows may vary but they shouldnt exceed 400.

--
Richard


--

Dave Peterson


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben
 
Posts: n/a
Default Delete Row If Empty Macro

Richard

Sub delete_rows()
Dim RowNdx As Long
Dim LastRow As Long
LastRow = ActiveSheet.UsedRange.Rows.Count
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "A").Value = "" Then
Rows(RowNdx).Delete
End If
Next RowNdx
End Sub

Note: you don't need a macro to do this.

Select column A and F5SpecialBlanksOK

EditDeleteEntire Row.


Gord Dibben MS Excel MVP

On Fri, 20 Jan 2006 14:21:03 -0800, "Richard"
wrote:

Using: MS OS XP
Excel 2003

I have tried and need some help for some VBA code in a macro.

I have a table of about 400 rows. The rows may vary but not be over 400. I
need to check the cells in column A. If the cell in column A is empty then I
want to delete the entire row and go and check the next cell in column A etc.

The rows may vary but they shouldn’t exceed 400.


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
How do I delete checkboxes from rows I deleted in a macro? Jazzi-D Excel Discussion (Misc queries) 1 January 18th 06 12:49 AM
Macro code for dropping to next empty cell JB2010 Excel Discussion (Misc queries) 4 November 3rd 05 01:35 PM
set up a macro to delete characters in each cell of a column Rick Excel Discussion (Misc queries) 2 September 18th 05 03:02 AM
Macro to delete first line of 200+ files Bob Dobalina Excel Discussion (Misc queries) 2 May 26th 05 10:04 PM
delete personal macro kalz Excel Discussion (Misc queries) 3 March 22nd 05 03:13 AM


All times are GMT +1. The time now is 12:05 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"