Good evening,
I'd like to modify the code below so that if the string "pieces" does not return a match, then I want the value for b to equal the row number of the last entry in column T.
Dim a As Long, b As Long
Dim rng As Range
Dim ws As Worksheet
Dim c As String
Set rng = Range("B1", Cells(Rows.Count, "B").End(xlUp))
a = WorksheetFunction.Match("Hours Paid:", rng, 0) + 1
b = WorksheetFunction.Match("Pieces:", rng, 0) - 1
c = WorksheetFunction.Sum(Range("T" & a & ":T" & b))
Range("T" & b + 1) = c
Sheets("Appendix D Calc").Activate
Range("H7") = c
M
Bookmarks