Capturing cell address and contents

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an inserted "picture" sitting atop a cell. Im 'Assigning a Macro' to
this picture to execute an event. My question is I would like to capture
both the cell address AND the cell contents of the cell this picture sits
atop of. Can I programmatically capture this from a pictures position?

thank you
 
Take a look at the Shape Object's TopLeftCell property in XL/VBA Help.

Address: ActiveSheet.Pictures(1).TopLeftCell.Address
Contents: ActiveSheet.Pictures(1).TopLeftCell.Value
 
Sub myOnActionMacro()
Dim sCaller As String
Dim sAddr As String
Dim vContents

sCaller = Application.Caller
With ActiveSheet.Shapes(sCaller).TopLeftCell
sAddr = .Address
vContents = .Value
End With

MsgBox sCaller & vbCr & sAddr & vbCr & vContents

End Sub

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top