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 45 46 47 48 49 50 51 52 53 54 55
|
Sub TesterMettreEnPlaceImage()
Dim ColonneVariation As Long
Dim DerniereLigneVariation As Long
Dim I As Long
Dim ShEnCours As Worksheet
Dim ShapeVariation As Shape
Set ShEnCours = Sheets("Feuil1")
ColonneVariation = 5
With ShEnCours
If .Shapes.Count > 0 Then
For Each ShapeVariation In .Shapes
Select Case ShapeVariation.Name
Case "En hausse", "En baisse", "Egal"
ShapeVariation.Delete
End Select
Next ShapeVariation
End If
DerniereLigneVariation = .Cells(.Rows.Count, ColonneVariation).End(xlUp).Row
For I = DerniereLigneVariation To 3 Step -1
If .Cells(I, ColonneVariation) <> "" Then
MettreEnPlaceImage .Cells(I, ColonneVariation + 1), .Cells(I, ColonneVariation).Value
End If
Next I
End With
Set ShEnCours = Nothing
End Sub
Sub MettreEnPlaceImage(ByVal CelluleDestination As Range, ByVal VariationkWh As Single)
With Sheets("images_depenses")
If .Shapes.Count > 0 Then
Select Case VariationkWh
Case Is > 0
.Shapes("En hausse").Copy
CelluleDestination.PasteSpecial
Selection.Name = "En hausse"
Case 0
.Shapes("Egal").Copy
CelluleDestination.PasteSpecial
Selection.Name = "Egal"
Case Is < 0
.Shapes("En baisse").Copy
CelluleDestination.PasteSpecial
Selection.Name = "En baisse"
End Select
End If
End With
End Sub |
Partager