luisgiraldo89
New Member
- Joined
- Apr 18, 2016
- Messages
- 8
Hi Guys,
1. I Have this code below. It inserts and re-sizes image to a selected cell. This code works beautifully. I would like to insert the image and insert the image name in the column over.
For example: All my images will be in the column A. So if i choose to put a image in cell A4 i want cell b4 to state the image name. So if the image is call myphoto.jpg i want cell b4 to say "myphoto".?
2. A bonus solution:
Another solution i was looking for is to have a userform with this code where the person can select the cell they want to put the picture in.
For example: Insert picture in cell A5?
3. I really like this code it re-sizes a perfect column width and height so i just want to add this code and insert the above solutions if possible? Also i can donate to anybody willing to help?
1. I Have this code below. It inserts and re-sizes image to a selected cell. This code works beautifully. I would like to insert the image and insert the image name in the column over.
For example: All my images will be in the column A. So if i choose to put a image in cell A4 i want cell b4 to state the image name. So if the image is call myphoto.jpg i want cell b4 to say "myphoto".?
2. A bonus solution:
Another solution i was looking for is to have a userform with this code where the person can select the cell they want to put the picture in.
For example: Insert picture in cell A5?
3. I really like this code it re-sizes a perfect column width and height so i just want to add this code and insert the above solutions if possible? Also i can donate to anybody willing to help?
Code:
Private Sub CommandButton1_Click()
Dim myPicture As String
myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", , "Select Picture to Import")
If myPicture <> "" Then
ActiveSheet.Pictures.Insert (myPicture)
ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Select
With Selection
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = ActiveCell.RowHeight
.ShapeRange.Width = ActiveCell.Width
.Placement = xlMoveAndSize
End With
End If
End Sub