Sub copyone()
Dim i As String
i = Worksheets("vozaci2009").Range("b1")
Select Case i
Case "1"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("b5:b50")
Case "2"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("c5:c50")
Case "3"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("d5:d50")
Case "4"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("e5:e50")
Case "5"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("f5:f50")
Case "6"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("g5:g50")
Case "7"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("h5:h50")
Case "8"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("i5:i50")
Case "9"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("j5:j50")
Case "10"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("k5:k50")
Case "11"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("l5:l50")
Case "12"
Worksheets("vozaci2009").Range("b5:b50").Copy Worksheets("sheet2").Range("m5:m50")
End Select
End Sub
This code copy workhours of drivers from the sheet vozaci2009 to the sheet2 and work excellent if the list of drivers on sheet vozaci2009 range A5:A50 is the equal with list of driver on the sheet2 range A5:A50. In my case
list of drivers on the sheet vozaci2009 is dynamic and list of drivers on the sheet2 is static. If some driver leave from list on sheet vozaci2009 code will misinserted workhours of drivers on the sheet2.
How can I solve this problem.
Thanks,
Bookmarks