Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I delete checkboxes from rows I deleted in a macro? | Excel Discussion (Misc queries) | |||
Macro code for dropping to next empty cell | Excel Discussion (Misc queries) | |||
set up a macro to delete characters in each cell of a column | Excel Discussion (Misc queries) | |||
Macro to delete first line of 200+ files | Excel Discussion (Misc queries) | |||
delete personal macro | Excel Discussion (Misc queries) |