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 44
|
Sub Macro1()
Dim Delta As Integer
Dim i As Integer
Dim s As Variant
Application.ScreenUpdating = False
Delta = 6
' Boucle sur toutes les lignes du Catalogue
For i = 2 To 3
Range("B" & Delta) = Workbooks("ES-Catalogue.xlsm").Sheets("Param Services").Range("A" & i).Value
Range("M" & Delta + 1) = Workbooks("ES-Catalogue.xlsm").Sheets("Param Services").Range("B" & i).Value
Range("Q" & Delta + 2) = Workbooks("ES-Catalogue.xlsm").Sheets("Param Services").Range("E" & i).Value
' Catalogue actif
Workbooks("ES-Catalogue.xlsm").Activate
Sheets("Param Services").Select
' ex ligne : ActiveSheet.Shapes.Range(Array("Picture 170")).Select
For Each shp In ActiveSheet.Shapes
If shp.Top = Workbooks("ES-Catalogue.xlsm").Sheets("Param Services").Range("D" & i).Top Then
Selection.Copy
' Edition du catalogue actif
Workbooks("ES-Edition du Catalogue des Services.xlsm").Activate
Range("B" & Delta + 2).Select
'
' Suppression de l'image résiduelle
For Each s In ActiveSheet.Shapes
If Not Intersect(s.TopLeftCell, ActiveCell) Is Nothing Then s.Delete
Next s
'
' Copie de la nouvelle image à la bonne taille
ActiveSheet.Paste
Selection.ShapeRange.ScaleHeight 0.4693333333, msoFalse, msoScaleFromTopLeft
End If
Next
Delta = Delta + 5
Next i
Application.ScreenUpdating = True
End Sub |