• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Deleting certain rows and finding last.

leimst

Member
Hello,

I am looking for VBA code that would find the blanks in the QBRat column and delete those entire rows, e.g. Matt Ryan and Matt Cassel and then find the last row in the spreadsheet and calculate the Pct column down to through that last row. (Comp / Att * 100 = Pct).

Thank you in advance for any help!

leimst
 

Attachments

  • Example.xlsx
    12.7 KB · Views: 6
Leimst

Have a look at:

Code:
Sub Fixup_Data()
Dim i As Integer

Sheets("Sheet1").Select
LastRow = Cells(Rows.Count, "a").End(xlUp).Row
For i = LastRow To 2 Step -1
  If Cells(i, 4).Value = "" Then Rows(i).Delete Shift:=xlUp
Next

LastRow = Cells(Rows.Count, "a").End(xlUp).Row
Range(Cells(2, 7), Cells(LastRow, 7)).FormulaR1C1 = "=(RC[-2]/RC[-1])"

End Sub
 
Leimst

This should go OK.

Code:
Sub GetRid()
Dim rng As Range
Set rng = Sheet1.Range("A2", Sheet1.Range("A" & Rows.Count).End(xlUp))
 
  rng.Offset(, 3).SpecialCells(4).EntireRow.Delete
  rng.Offset(, 6) = "=(E2/F2)"
End Sub

Take care

Smallman
 
Back
Top