ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I assign a picture to a cell (https://www.excelbanter.com/excel-programming/418925-how-do-i-assign-picture-cell.html)

Brett17

How do I assign a picture to a cell
 
I have 5 pictures (well 5 copies of 1 pic) that I want in B2 C4 C6 D3 & D5 to
begin with. I guess thats a reset button. Next I want to be able to move the
pics one at a time, but can only be put in certain cells. Click move Click
preferred but Click & Drag ok. And last I need a counter eg number of moves.


Peter T

How do I assign a picture to a cell
 
Pictures, indeed all objects (except comments) are not assigned to cells.
They have a position coordinates, L,T,W, & H. Also you can return, though
not set, the TopLeft and BottomRight corner cells as range objects.

To position an object in a particular cell you can do this

dim rCell as Range
dim shp As Shape
Set shp = Activesheet.Shapes("Picture 1")
set rCell = Range("B2")
With shp
..Left = rCell.Left
..Top = rCell.Top
End With

It's easy to implement the above in with multiple objects. You do though
need to have an idea of how (eg names or index) to reference the objects and
corresponding cells.

If you get stuck post back the names of your pictures and related cells.

I have no idea what you mean by counter and moves.

Regards,
Peter T

"Brett17" wrote in message
...
I have 5 pictures (well 5 copies of 1 pic) that I want in B2 C4 C6 D3 & D5
to
begin with. I guess thats a reset button. Next I want to be able to move
the
pics one at a time, but can only be put in certain cells. Click move Click
preferred but Click & Drag ok. And last I need a counter eg number of
moves.





All times are GMT +1. The time now is 11:15 PM.

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