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 32 33 34 35 36 37 38 39 40 41 42 43
| Sub Bouton1_Cliquer()
Dim classCourant As Workbook
Dim feuilleCourant As Worksheet
Dim cellsSource As Variant
Dim cellsDestination1 As Variant
Dim cellsDestination2 As Variant
Dim DernLigneE As Long
Dim DernLigneS As Long
Dim EntityE, EntityS, PH As Variant
Dim listEntity, listStatus As Worksheet
Set classCourant = ActiveWorkbook
Set listEntity = Worksheets("Entity listing")
Set listStatus = Worksheets("Status Actual")
Set DernLigneE = listEntity.Range("A" & Rows.Count).End(xlUp).Row
Set DernLigneS = listStatus.Range("A" & Rows.Count).End(xlUp).Row
For I = 0 To DernLigneE
Set EntityE = listEntity.Cells(I, 1)
Set cellsDestination1 = listeEntity.Cells(I, 2)
Set cellsDestination2 = listeEntity.Cells(I, 3)
For J = 0 To DernLigneS
Set EntityS = Sheets(2).Cells(J, 2)
Set PH = Sheets("Status Actual").Cells(J, 1)
Set cellsSource = listStatus.Cells(J, 3)
If EntityE = EntityS Then
If PH = "PH1" Then
cellsDestination1 = cellsSource
Else
cellsDestination2 = cellsSource
End If
End If
Next J
Next I
End Sub |
Partager