Thread: Deleting rows
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
gti_jobert[_44_] gti_jobert[_44_] is offline
external usenet poster
 
Posts: 1
Default Deleting rows


Hi all,

Trying to loop through entire woorksheet and then based on cell
criteria (empty or not) delete the entire row. I have the following
implemented....but dows not work;


Code:
--------------------

Private Sub cmdFilter_Click()

'Copy Data Sheet & Paste Data onto a New Sheet
Cells.Select
Selection.Copy
Worksheets.Add
ActiveSheet.Paste
ActiveSheet.Rows(1).Select
Selection.Delete

'Delete rows that are not needed
strMySheet = ActiveSheet.Name
Sheets(strMySheet).Select


Sheets(strMySheet).Cells(1, 1).Select

i = 1
Do
If (Cells(i, 4).Value = "") And (Cells(i, 5).Value < "") Then
Sheets(strMySheet).Cells(i, 1).Select
Selection.EntireRow.Delete
End If
i = i + 1
Loop Until (Sheets(strMySheet).Cells(i, 1).Value < "")

End Sub

--------------------


Any tips or feedback welcome! Thanks


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=517729