Thread: Deleting rows
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Deleting rows

Hi GTI,

Try:

'=============
Public Sub Tester()
On Error Resume Next
ActiveSheet.Columns(1). _
SpecialCells(xlBlanks).EntireRow.Delete
On Error GoTo 0
End Sub
'<<=============


---
Regards,
Norman


"gti_jobert" wrote
in message ...

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