I have this macro that works very well to insert pic in any cell
once on the cell a double click opens the directory for selection of picture.
After selection the picture is inserted and resized according to cell size.
If you play with height or width of cell after the pic is always redimentioned accordingly...
This works fine with excel 2003
I have a pbe with excel 2007.
Macro works but if you change height of cell the pict wont be adjusted anymore.
With height of cell adjustement of pic still takes place...
If someone can fix this so it works on excel 2007 it would be great.
on sheet
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Application.Dialogs(xlDialogInsertPicture).Show
larg = Target.Width
haut = Target.Height
horiz = Target.Left
vert = Target.Top
Cancel = True
imag
End Sub
In modules for the macro
Public haut As Double
Public larg As Double
Public horiz As Double
Public vert As Double
Public Sub imag()
On Error GoTo fin
With Selection
.Top = vert
.Left = horiz
.Width = larg
.Height = haut
.Placement = xlMoveAndSize
.PrintObject = True
End With
fin:
End Sub
once on the cell a double click opens the directory for selection of picture.
After selection the picture is inserted and resized according to cell size.
If you play with height or width of cell after the pic is always redimentioned accordingly...
This works fine with excel 2003
I have a pbe with excel 2007.
Macro works but if you change height of cell the pict wont be adjusted anymore.
With height of cell adjustement of pic still takes place...
If someone can fix this so it works on excel 2007 it would be great.
on sheet
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Application.Dialogs(xlDialogInsertPicture).Show
larg = Target.Width
haut = Target.Height
horiz = Target.Left
vert = Target.Top
Cancel = True
imag
End Sub
In modules for the macro
Public haut As Double
Public larg As Double
Public horiz As Double
Public vert As Double
Public Sub imag()
On Error GoTo fin
With Selection
.Top = vert
.Left = horiz
.Width = larg
.Height = haut
.Placement = xlMoveAndSize
.PrintObject = True
End With
fin:
End Sub