Hi everyone,
I'm using the below formula and I want to paste image from clipboard in certain area - however when i do it, the image doesn't fit in that section properly and either shrinks so much or so little.
Also, if there is no image on the clipboard or text - then I want the message box pop up to say "nothing to copy".
Thank you for your help.
I'm using the below formula and I want to paste image from clipboard in certain area - however when i do it, the image doesn't fit in that section properly and either shrinks so much or so little.
Also, if there is no image on the clipboard or text - then I want the message box pop up to say "nothing to copy".
Thank you for your help.
VBA Code:
Sub copy()
Dim p As Picture
Dim Target As Range
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="abc"
Set p = ActiveSheet.Pictures.Paste
Set Target = Range("B3:I26")
With Target
p.ShapeRange.LockAspectRatio = msoFalse 'Allows Proper Sizing
p.Top = .Top
p.Left = .Left
p.Width = .Width
p.Height = .Height
End With
ActiveSheet.Protect Password:="abc", DrawingObjects:=False, contents:=True, Scenarios:=True
End Sub