Marco to delete rows


Posted by Jim on October 31, 2001 5:13 PM

I need help on a Marco to look in A1:A100 and if it finds Restaurants, Supermarkets, or Clubs I want it to delete the row that they are in. thanks for your help in advance

Posted by Raich Carter on November 01, 2001 12:56 AM

Drew,

Select the cells that are merged, right click your mouse and choose format cells. Select the 'Alignment' tab and un-check the Merge Cells box.

Posted by Raich Carter on November 01, 2001 1:01 AM

Try this "marco" :-

Sub Delete_Rows()
Dim rng As Range, cell As Range, del As Range
Set rng = Intersect(Range("A1:A100"), ActiveSheet.UsedRange)
For Each cell In rng
If UCase(cell.Value) = "RESTAURANTS" _
Or UCase(cell.Value) = "SUPERMARKETS" _
Or UCase(cell.Value) = "CLUBS" Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next
del.EntireRow.Delete
End Sub




Posted by Jim on November 01, 2001 4:56 AM

Thanks Raich