I am new to the world of VB and I’m currently copying + pasting parts of my spreed sheet like this:
Sheets("Overview").Range("G4:P34").CopyPicture
Sheets("Overview").Paste Destination:=Worksheets("Overview").Range("T4")
So basically I’m just copying the area from G4 to P34 as an image and paste it starting at T4 which works fine so far. The thing is the newly created picture gets an automatically assigned Name
attribute so I can’t access it as simple as the following snippet, because I actually don’t know its name:
Sheets("Overview").Shapes("Picture xx").DoSomethingWithIt
My question is how can I access the picture I just pasted into my sheet? Any advice would be appreciated, many thanks in advance.
I think what you need is Application.Caller Property which returns what was called. An example is
sub pic()
ActiveSheet.Shapes(Application.Caller).Select
'some code
End Sub
This should select the last object(picture) without you having to remember its name. Here you can more about it
http://msdn.microsoft.com/en-us/library/office/ff193687(v=office.15).aspx
Tags: excelexcel, vba