View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_11_] Patrick Molloy[_11_] is offline
external usenet poster
 
Posts: 5
Default how to run through a table an delete the empty cells?

Klaus shows how to clear a cell in column B if the cell
in column A is blank.

The question asks how to "delete" A & B

Sub DeleteRows()
Dim Target As Range, thisrow As Range
Dim cell As Range
Set Target = _
ThisWorkbook.Names("MyTable").RefersToRange
For Each thisrow In Target.Rows
If thisrow.Range("A1") = "" Then
thisrow.Delete
End If
Next
End Sub

This will remove all cells in a table row - just pass the
table name or set the Target range to whatever range you
want

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
I need to write a macro to run through a list of values

in column A and
B.

If column A is blank, then I have to delete cells A and B
correspondingly.

Is it very difficult to do that?


---
Message posted from http://www.ExcelForum.com/

.