Hello, I have inserted pictures into my worksheet with this code:
I am having a problem when I try to sort the columns next to the pictures. Please take a look at the picture below:
If I sort the Item Number column, the pictures do not move and stay in their respective cells. Is there any way to change this? Thanks.
Code:
Sub InsertPicture()
Dim sPicture As String, pic As Picture
sPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif), *.gif; *.jpg; *.bmp; *.tif", _
, "Select Picture to Import")
If sPicture = "False" Then Exit Sub
Set pic = ActiveSheet.Pictures.Insert(sPicture)
With pic
.ShapeRange.LockAspectRatio = msoFalse
.Height = ActiveCell.Height
.Width = ActiveCell.Width
.Top = ActiveCell.Top
.Left = ActiveCell.Left
.Placement = xlMoveAndSize
.ShapeRange.LockAspectRatio = msoTrue
' etc.
End With
Set pic = Nothing
End Sub
I am having a problem when I try to sort the columns next to the pictures. Please take a look at the picture below:

If I sort the Item Number column, the pictures do not move and stay in their respective cells. Is there any way to change this? Thanks.