Forum Discussion
kadirguler
Jan 27, 2021Brass Contributor
Excel Insert Picture To Cell & View Picture It's Original Size
I created a template to insert a picture into another cell based on the text in the cell with VBA codes. Pictures are in the same folder as the workbook. The picture is fitted in the cell where it is inserted.When the added picture is clicked, it is displayed in its original size.
For example, the following codes can be entered to add the image that with the same name as the value of cell in column A to the cell in column D :
ActiveSheet.Pictures.Insert(ThisWorkbook.Path & "\" & Target.Value & ".jpg").Select
Selection.Top = Target.Offset(0, 2).Top
Selection.Left = Target.Offset(0, 3).Left
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = Target.Offset(0, 2).Height
Selection.ShapeRange.Width = Target.Offset(0, 3).Width
Details and sample files at : https://eksi30.com/insert-picture-in-cell-according-to-cell-value/
No RepliesBe the first to reply