Solved

How to click a picture within an xl cell and get the row and column values of that cell

Posted on 2014-11-11
3
102 Views
Last Modified: 2014-11-11
My xl WS has the same icon located in different cells of the same WS column. When one of those icons is clicked, I need to (1) obtain the row value within which the clicked icon was located AND (2) call a macro.

MY current FALL BACK SOLUTION is to make the xl cell within which the icon resides sufficiently WIDE for the user to double click part of the cell that is not occupied by Icon. This returns row and column values (via WS Double Click Event), but the user maneuver yields a poor user-experience!

I add icons to xl cells via automation:
    With Range(Cells(rn.row + 1, 7), Cells(rn.row + 1, 1))
        ActiveSheet.Shapes.AddPicture "D:\aaThink_Build\Thk_Building\xlImages\Fish.jpg", msoCTrue, msoTrue, .left, .top, -1, -1
        ActiveSheet.Shapes(ActiveSheet.Shapes.Count).height = .height
    End With

But even if I could (??) add the row/col values as icon FILE PROPERTIES (during automation) , I still dont know how to extract that information from the icon that is clicked. The icon files are .JPGs, but that can be changed.

Thanks,
Kelvin
0
Comment
Question by:Kelvin4
  • 2
3 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 40435387
Assign a macro to the inserted picture:

Sub PicClick()
msgbox Activesheet.SHapes(Application.Caller).Topleftcell.address
End Sub

Open in new window


:)
0
 

Author Closing Comment

by:Kelvin4
ID: 40435397
Oh yes, certainly :)!
Thanks for following up my first question!

Kelvin
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 40435448
Glad to help. :)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now