Friday, 10 July 2015

How to Resize or Delete the Picture Objects in Excel

VBA Macro to Resize or Delete the Picture Objects in Excel Activesheet
Sub Resize_Picture_Objects()
Dim WS As Worksheet

Set WS = ActiveSheet
Dim Obj As Object
On Error Resume Next

For Each Obj In WS.Pictures

Obj.Select

With Selection
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Width = 650
.ShapeRange.Height = 300
End With

Next Obj

Set WS = Nothing

End Sub
----------------------------------------------------------------------------------------------------------
To Delete the Picture Objects in Excel Activesheet:
Sub Delete_Picture_Objects()
Dim WS As Worksheet

Set WS = ActiveSheet
Dim Obj As Object
On Error Resume Next

For K = 1 To 2
For Each Obj In WS.Pictures

Obj.Delete

Next Obj
Next K

Set WS = Nothing

End Sub

No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts