Simple Macro to copy and paste picture

Gitterdan

New Member
Joined
Jul 27, 2011
Messages
1
Hey Guys this is probably an easy one. I have a picture saved in an excel sheet hidden off to the side so no one can see it. I want to have a button that when you click the image is copied and pasted somewhere in the current view. The image is named calendar or picture 665.

Thanks,
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hope this helps. Maybe you could just make your picture visible or invisible instead of moving it around?

Gary

Code:
Public Sub Test()

Dim oShape As Shape

'Change "picture 665" (below) as required
Set oShape = ActiveSheet.Shapes("picture 665")

'Move top left corner of picture to cell B3
oShape.Top = ActiveSheet.Range("B3").Top
oShape.Left = ActiveSheet.Range("B3").Left

'Instead of moving picture change visiblity
If oShape.Visible = msoTrue Then
    oShape.Visible = msoFalse
Else
    oShape.Visible = msoTrue
End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,445
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top