I have a workbook that keeps track of my business. The main worksheet is called “Dashboard” and everything shows up there in pivot tables. I have a worksheet named “Labor” that shows what employees have worked and what I owe them. The pivot table for “labor” on the “Dashboard” sheet, I have created a macro that I have attached to shapes called Pay. When clicked on the shape the macro finds the amount owed for that person in the “Labor” sheet in Column S and selects that cell and then offsets by 3 to the “Return” column that I enter the return amount. My problem is that if there are two different people, I owe the same amount to it just finds the first matching amount which may not be the correct person. I need a macro to match the amount with the name in the labor sheet.
Happy Holidays
Jim
Sub LBR_1()
' Works off of Pay Buttons
Application.ScreenUpdating = False
Worksheets("Labor").Visible = True
Application.CutCopyMode = False
Worksheets("Labor").UnProtect
Worksheets("Labor").Select
Dim lastrow As Long
With Sheets("Labor")
lastrow = .Cells(.Rows.Count, "S").End(xlUp).row
End With
lookupvalue = Worksheets("Dashboard").Range("F20").Value
lookuprange = Worksheets("Labor").Range("S1:S" & lastrow)
On Error GoTo ErrorMesageBox
MatchRowNumber = WorksheetFunction.Match(lookupvalue, lookuprange, 0)
Worksheets("Labor").Range("S" & MatchRowNumber).Select
ActiveCell.Offset(0, -3).Select
Application.ScreenUpdating = True
Exit Sub
ErrorMesageBox: MsgBox "This number is not found. Please go to the Labor Sheet to find the Problem"
Exit Sub
End Sub
Happy Holidays
Jim
Sub LBR_1()
' Works off of Pay Buttons
Application.ScreenUpdating = False
Worksheets("Labor").Visible = True
Application.CutCopyMode = False
Worksheets("Labor").UnProtect
Worksheets("Labor").Select
Dim lastrow As Long
With Sheets("Labor")
lastrow = .Cells(.Rows.Count, "S").End(xlUp).row
End With
lookupvalue = Worksheets("Dashboard").Range("F20").Value
lookuprange = Worksheets("Labor").Range("S1:S" & lastrow)
On Error GoTo ErrorMesageBox
MatchRowNumber = WorksheetFunction.Match(lookupvalue, lookuprange, 0)
Worksheets("Labor").Range("S" & MatchRowNumber).Select
ActiveCell.Offset(0, -3).Select
Application.ScreenUpdating = True
Exit Sub
ErrorMesageBox: MsgBox "This number is not found. Please go to the Labor Sheet to find the Problem"
Exit Sub
End Sub