Nur Bilder Zentrieren
31.07.2021 16:12:23
oraculix
Habe mir aus der Recherche ein Makro zusammengewürfelt das auch gut funktioniert nur etwas langsam aber ok.
In der Tabelle habe ich viele Bilder die ich Zentrieren möchte und alle sollen die gleiche Größe bekommen.
Doch leider werden sämtliche Textfelder und Commandbuttons auch vergrößert.
Frage : Was muss ich Ändern damit die Commandbuttons und Textfelder nicht geändert werden sondern nur die Bilder?
Die Buttons sind alle in Zeile 1
Gruß
Oraculix
'Alle Bilder Zentrieren
Public Sub Center_Picture()
Dim objShape As Shape
Dim objPic As Object
For Each objShape In Tabelle6.Shapes
With objShape
If .Type = msoPicture Then
.Left = .TopLeftCell.Left + .TopLeftCell.Width / 2 - .Width / 2
.Top = .TopLeftCell.Top + .TopLeftCell.Height / 2 - .Height / 2
End If
End With
For Each objPic In ActiveSheet.Pictures
'Alle Grafiken formatieren :
With objPic.ShapeRange
.LockAspectRatio = False
.Height = Application.CentimetersToPoints(4.2)
.Width = Application.CentimetersToPoints(6.22)
End With
Next
Next
End Sub