ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Capturing cell address and contents (https://www.excelbanter.com/excel-programming/395202-capturing-cell-address-contents.html)

Bret

Capturing cell address and contents
 
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

JE McGimpsey

Capturing cell address and contents
 
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

In article ,
Bret wrote:

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


Peter T

Capturing cell address and contents
 
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

"Bret" wrote in message
...
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





All times are GMT +1. The time now is 05:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com