preset range

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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?
.



Relevant Pages

  • Re: preset range
    ... Are those three text strings you are testing for all located in the same column or can the be located in any of the columns within the range A8:Z300? ... Rng = Selection.Rows.Count ... ElseIf ActiveCell.Value = "Company" Then ... range of "A8:Z300" as the selection set. ...
    (microsoft.public.excel.programming)
  • Re: Adding More Conditional Formating
    ... have in my sheet code, ... Private Sub Worksheet_Calculate ... For Each rng In Range ... ElseIf rng.Value = "KFI" Then ...
    (microsoft.public.excel.programming)
  • Re: Adding More Conditional Formating
    ... have in my sheet code, ... Private Sub Worksheet_Calculate ... For Each rng In Range ... ElseIf rng.Value = "KFI" Then ...
    (microsoft.public.excel.programming)
  • Re: Adding More Conditional Formating
    ... have in my sheet code, ... Private Sub Worksheet_Calculate ... For Each rng In Range ... ElseIf rng.Value = "KFI" Then ...
    (microsoft.public.excel.programming)
  • Re: sort only rows with data
    ... column AR for only the zero cells, not all the cells in the range. ... Dim rng As Range, c As Range ... Dim MyMax As Double ...
    (microsoft.public.excel.programming)