Hi all,
I have a macro below that inserts an image from my C drive into an excel sheet an although this works nicely for what I need, I now need to get it to crop and move back to the right place when it has been cropped. does anyone know what i need to add to the code to get this to work?
I have a macro below that inserts an image from my C drive into an excel sheet an although this works nicely for what I need, I now need to get it to crop and move back to the right place when it has been cropped. does anyone know what i need to add to the code to get this to work?
Code:
Sub test()
Dim picture As Object
Dim address As String
Dim x As Integer
Dim y As Integer
Dim a As Integer
Dim b As Integer
address = Range("JPEG")
x = Range("X7:Z7").Width
y = Range("X7:X72").Height
Range("AA7").Select
With ActiveSheet.Pictures.Insert(address)
.Left = Range("X7:z78").Left
.Top = Range("X7:z78").Top
.Width = Range("X7:z78").Width
.Height = Range("X7:Z78").Height
***
End With
'a = picture.ShapeRange.Width
'b = picture.ShapeRange.Height
'picture.ShapeRange.LockAspectRatio = msoTrue
'If a > b Then
'picture.ShapeRange.Width = x
'Else
'picture.ShapeRange.Height = y
'End If
'picture.ShapeRange.Rotation = 0#
'picture.ShapeRange.IncrementLeft (x - picture.ShapeRange.Width) / 2
'picture.ShapeRange.IncrementTop (y - picture.ShapeRange.Height) / 2
End Sub