A
Anice
I am new to programming in VBA, and I am having trouble getting my program to
do what I want it too. Basically, We enter names and hours worked into one
sheet, then I want to find that persons hourly rate from another worksheet
and multiply it by their hours. These totals need to be added together to
only include employees of the company and not contractors, material, or
travel (that is what the "M" stands for). I am getting runtime errors when I
run the program. Any help, suggestions or otherwise is greatly appreciated!!
Function Labor()
Dim row As Long
ActiveCell.Formula = 0
For row = 3 To 34
If Worksheets("INPUT").Cells(row, "C").Value = "M" Then
ML =
Application.WorksheetFunction.Index(Worksheets("NAMES").Range("A10:K100"),
Application.WorksheetFunction.Match(Worksheets("INPUT").Cells(row, D).Value,
Worksheets("NAMES").Range("A10:A100"), 1), WorksheetFunction.Match(H1,
Worksheets("NAMES").Range("A10:K10"), 1)) * Cells(row, "H")
ActiveCell.Formula = ActiveCell.Formula + ML
End If
Next row
End Function
Thank you!!
do what I want it too. Basically, We enter names and hours worked into one
sheet, then I want to find that persons hourly rate from another worksheet
and multiply it by their hours. These totals need to be added together to
only include employees of the company and not contractors, material, or
travel (that is what the "M" stands for). I am getting runtime errors when I
run the program. Any help, suggestions or otherwise is greatly appreciated!!
Function Labor()
Dim row As Long
ActiveCell.Formula = 0
For row = 3 To 34
If Worksheets("INPUT").Cells(row, "C").Value = "M" Then
ML =
Application.WorksheetFunction.Index(Worksheets("NAMES").Range("A10:K100"),
Application.WorksheetFunction.Match(Worksheets("INPUT").Cells(row, D).Value,
Worksheets("NAMES").Range("A10:A100"), 1), WorksheetFunction.Match(H1,
Worksheets("NAMES").Range("A10:K10"), 1)) * Cells(row, "H")
ActiveCell.Formula = ActiveCell.Formula + ML
End If
Next row
End Function
Thank you!!