Hallo!
Folgende Situation:
Ich habe eine Auswahlliste definiert mit fünf Auswahlmöglichkeiten. Je nachdem welche gewählt wird, erscheint in der Zelle daneben ein Bild. Der Code funktioniert bei mir einwandfrei, jedoch nur so lange bis ich den gleichen Code in einer anderen Spalte noch einmal anwenden möchte. Ich hoffe, ich hab mein Problem annähernd verständlich erklärt (-;
Hier mein Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim Bild As Shape
Dim PicName, ZellenName As String
For Each Shape In Me.Shapes
If Shape.Type = msoPicture Then
Shape.Delete
End If
Next
For i = 3 To 300
ZellenName = „V“ & i
PicName = „PicG“ & i
With Range(ZellenName)
For Each Bild In Sheets(„Trend“).Shapes
If Bild.Name = .Text Then
Bild.Visible = True
Bild.Copy
Sheets(„ORG“).Paste Range(ZellenName)
Me.Shapes(.Text).Name = PicName
Me.Shapes(PicName).Left = .Left
Me.Shapes(PicName).Top = .Top
End If
Next Bild
End With
Next i
For i = 3 To 300
ZellenName = „Y“ & i
PicName = „PicG“ & i
With Range(ZellenName)
For Each Bild In Sheets(„Trend“).Shapes
If Bild.Name = .Text Then
Bild.Visible = True
Bild.Copy
Sheets(„ORG“).Paste Range(ZellenName)
Me.Shapes(.Text).Name = PicName
Me.Shapes(PicName).Left = .Left
Me.Shapes(PicName).Top = .Top
End If
Next Bild
End With
Next i
Application.ScreenUpdating = True
End Sub
Danke schon mal!
Lg Elke