1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Sub mapping()
Dim cell_move As Range
Dim tourne As Integer
Dim off As Integer
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
With Workbooks("MATRICE PLANNING 2014_v5.xlsm").Worksheets("MATRICE 2014")
Set cell_move = .Range("B10")
.Range("C11:AG58").ClearContents
For i = 1 To .Rows(7).Find("*", , , , , xlPrevious).Column - 2
For j = 1 To .Columns(1).Find("*", , , , , xlPrevious).Row Step 2
tourne = .Range("B5").Offset(0, i)
off = Weekday(.Range("B7").Offset(0, i), vbMonday)
With Workbooks("MATRICE PLANNING 2014_v5.xlsm").Worksheets("EMPLOI DU TEMPS EDUCATIF")
If Not .Columns(2).Find(cell_move.Offset(j, 0), LookIn:=xlValues, LookAt:=xlWhole) Is Nothing And Not .Rows(2).Find(tourne, LookIn:=xlValues, LookAt:=xlWhole) Is Nothing Then
cell_move.Offset(j, i) = .Range("B1").Offset(.Columns(2).Find(cell_move.Offset(j, 0), LookIn:=xlValues, LookAt:=xlWhole).Row - 1, .Rows(2).Find(tourne, LookIn:=xlValues, LookAt:=xlWhole).Column + off - 2)
End If
End With
Next j
Next i
End With
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
'MsgBox "Fin de la mise à jour"
End Sub |