Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- With ThisWorkbook.Worksheets("Sheet2").Columns("A")
- Set rFound = .Find(lJobCode, .Cells(.Cells.Count), xlValues, xlWhole)
- If Not rFound Is Nothing Then
- If ThisWorkbook.Worksheets("Sheet2").Cells(rFound.Row, 3).Value = lCC Then
- matched = True
- Public Function LocateFind() As Range
- Dim rngCell As Range
- Dim rngRangeToLookAt As Range
- Set rngRangeToLookAt = Range("A1:A100")
- Set LocateFind = rngRangeToLookAt.Find("YourValueHere", searchdirection:=xlPrevious)
- End Function
- Option Explicit
- Sub tgr()
- Dim rFound As Range
- Dim lJobCode As String, lFLSA As String, lCC As String
- Dim sFirst As String
- Dim sResults As String
- Dim sh As Worksheet
- Dim matched As Boolean
- Dim Y As String, Z As String
- lJobCode = Application.InputBox("Please provide a job code", "Job Code", Type:=2)
- lCC = Application.InputBox("Please enter in a cost-center", "CC", Type:=2)
- If lJobCode = "False" Or lCC = "False" Then Exit Sub 'Pressed cancel
- Set sh = Sheets("Sheet1")
- With ThisWorkbook.Worksheets("Sheet2").Columns("A")
- Set rFound = .Find(lJobCode, .Cells(.Cells.Count), xlValues, xlWhole)
- If Not rFound Is Nothing Then
- If ThisWorkbook.Worksheets("Sheet2").Cells(rFound.Row, 3).Value = lCC Then
- matched = True
- If rFound.Offset(, 4).Value = "Exempt" And Y = 0 Then
- MsgBox "Exempt roles ...."
- Y = 1
- Exit Sub
- End If
- If rFound.Offset(, 5).Value = "Eligible - Employee Level" And Z = 0 Then
- MsgBox "This job is only eligible at the employee level"
- Z = 1
- Exit Sub
- End If
- If Not matched Then MsgBox "Job Code (" & lJobCode & ") found, but not eligible for this cost-center"
- Else
- MsgBox "Job Code (" & lJobCode & ") not eligible."
- End If
- End With
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement