Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted by registered user beny1014 ( 14 years ago )
Sub DeleteBlankRows()

'COPY JOB ROWS TO COLUMN C FOR DELETING PROCESS
lastrow = 450
Row = 7

Do Until Row = lastrow
Cells(Row, 1).Select
jobname = ActiveCell

If jobname <> "" Then
ActiveCell.Offset(0, 3).Select
ActiveCell = jobname
End If

Row = Row + 1
Loop


'DELETE BLANK ROWS
    Dim i As Long

    'We turn off calculation and screenupdating to speed up the macro.
    With Application
        .Calculation = xlCalculationManual
        .ScreenUpdating = False
      
    'We work backwards because we are deleting rows.
    Cells.Range("D5:D450").Select
    For i = Selection.Rows.Count To 1 Step -1
        If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
            Selection.Rows(i).EntireRow.Delete
        End If
    Next i

        .Calculation = xlCalculationAutomatic
        .ScreenUpdating = True
    End With

    

'FIX EQUIPMENT NUMBERS THAT ARE MISSING
Row = 7
Do Until Row = lastrow
Cells(Row, 2).Select
Number = ActiveCell

If Number = "" Then
ActiveCell.Offset(0, -1).Select
reference = ActiveCell
If reference = "" Then
    ActiveCell.Offset(-1, 1).Select
    ActiveCell.Copy
    ActiveCell.Offset(1, 0).Select
    ActiveSheet.Paste
    End If
End If
Row = Row + 1
Loop

End Sub

 

Revise this Paste

Your Name: Code Language: