Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Esrei
I wrote the code below a while ago and I think it may be of some use to you. List your picture names in the worksheet (i.e. my picture.jpg) then when you click on this cell a rectangle with the picture will show beside that cell. In the module for the worksheet with your picture names paste the following code. Option Explicit Dim H, V As Integer Dim I As Integer Dim MyDoc As Worksheet Private Sub Worksheet_SelectionChange(ByVal Target As Range) Set MyDoc = ActiveSheet 'Set your worksheet H = Target.Offset(0, 1).Left 'Get the values for placement V = Target.Offset(0, 1).Top 'of the picture I = MyDoc.Shapes.Count 'Count shapes in MyDoc If I 0 Then 'If any shape exist delete all shapes MyDoc.Shapes("Comment").Select Selection.Delete End If If Target.Count 1 Then 'Check than only one cell is selected Exit Sub End If If Target.Value = "" Then 'Check cell has a value Exit Sub End If 'Load the picture to the shape, 200 = shape width, 100 = shape height 'the file location should be changed to show your picture directory. MyDoc.Shapes.AddShape(msoShapeRectangle, H, V, 200, 100).Select Selection.Name = "Comment" Selection.ShapeRange.Fill.UserPicture "C:\Pics\" & Target.Value End Sub Hope it helps you S |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert, position, and resize a picture w/ Macro | Excel Discussion (Misc queries) | |||
Insert Picture Macro. | Excel Programming | |||
Insert Picture Name Assignment in Macro | Excel Programming | |||
Insert Picture Macro | Excel Programming | |||
INSERT PICTURE IN MACRO | Excel Programming |