I make this code:
Sub macro4()
Dim mymonth As String
mymonth = Application.Worksheets("drivers").Range("b1")
Application.ScreenUpdating = False
Select Case mymonth
Case "1"
Sheets("drivers").Select
Range("d5:d36").Copy
Sheets("overtime").Select
Range("v2:v36").Select
Selection.PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks:=False, Transpose:=False
Application.CutCopyMode = False
Case "2"
Sheets("drivers").Select
Range("d5:d36").Copy
Sheets("overtime").Select
Range("w2:w36").Select
Selection.PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks:=False, Transpose:=False
Application.CutCopyMode = False
End Select
End Sub
In this code I must condition who will compare range of employees in the sheets "overtime"(column P2:P40) and range of employees in the sheets "drivers"(column A2:a36).Afterwards when I run code value of working hours will be put in adequate cells.
E.C. if employee "John" is in second row in the sheets "driver" and in fourth
row in the sheets "overtime" value of working hours must be in fourth row
Bookmarks