View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 234
Default Lop to delete rows

Ron,

I had tried this but all rows are deleted, I turned off setting to manual
calc in case that was the issue but alas no. When entering =ISTEXT(A1), the
formula correctly returns Tue or False but macro deletes all rows.

I'll keep trying to figure it out. Thanks, Rob
"Ron de Bruin" wrote in message
...
Hi

Try this for Column A
Read more info on this page
http://www.rondebruin.nl/delete.htm

Sub Loop_Example()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

'We use the ActiveSheet but you can replace this with
'Sheets("MySheet")if you want
With ActiveSheet

'We select the sheet so we can change the window view
.Select

'If you are in Page Break Preview Or Page Layout view go
'back to normal view, we do this for speed
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

'Turn off Page Breaks, we do this for speed
.DisplayPageBreaks = False

'Set the first and last row to loop through
Firstrow = .UsedRange.Cells(1).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row

'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1

'We check the values in the A column in this example
With .Cells(Lrow, "A")

If Not IsError(.Value) Then

If Application.WorksheetFunction.IsText(.Value) = True
Then .EntireRow.Delete

End If

End With

Next Lrow

End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Rob" wrote in message
...
Using Excel 2000. I want to loop through column A of my worksheet and if
the contents are text, I want to delete the row. Tried all sorts of
suggestions on the web but can's seem to get Istex working.

Any suggestion welcome. Thank, Rob