Thread: Selecting Rows
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Selecting Rows

Sub DeleteRows()
With Worksheets(1).Columns(3)
Set c = .Find(17, lookin:=xlValues)
If Not c Is Nothing Then
Do
c.EntireRow.Delete
Set c = .FindNext(c)
Loop While Not c Is Nothing
End If
End With
End Sub

--
Regards,
Tom Ogilvy




"anar_baku" wrote
in message ...

Hi,

I have a worksheet in excel which has lots of rows and three columns.
Column A and B have data that is relevant to the list, but column C has
number "17" appearing on every 17th row. What I want my code to do is
delete every row that has 17 appearing in column C. I have managed to
put this code together, but I cannot make up the crucial bit of it:

With Worksheets(1).Range("C1:C10500")
Set c = .Find(17, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
XXXXXXXXXXXXXXX
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

The XXXXXXXXXXXXXXX above is the missing bit. Please help me out.

Thanks in advance.

Anar


--
anar_baku
------------------------------------------------------------------------
anar_baku's Profile:

http://www.excelforum.com/member.php...o&userid=18259
View this thread: http://www.excelforum.com/showthread...hreadid=509939