Thread: preset range
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Novice Lee Novice Lee is offline
external usenet poster
 
Posts: 36
Default preset range

I have the following Module:
Sub DelEmptyRow()
Rng = Selection.Rows.Count
ActiveCell.Offset(0, 0).Select
Application.ScreenUpdating = False
For i = 1 To Rng
If ActiveCell.Value = 0 Then 'You can replace "" with 0 to delete rows
with 'the value zero
Selection.EntireRow.Delete
ElseIf ActiveCell.Value = "Company" Then
Selection.EntireRow.Delete
ElseIf ActiveCell.Value = "Controlling Area :" Then
Selection.EntireRow.Delete
ElseIf ActiveCell.Value = "Proj. number" Then
Selection.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Next i
End Sub

What can I add so I don't have to select the data and use a pre determined
range of "A8:Z300" as the selection set. Also is there a way to make the code
smaller?