Hi everyone. I've seen quite a few postings that had similar problems when upgrading from 2003 to '07 or '10.
This macro was created using Excel 2003 and populated a report with pictures in column B based on the style numbers listed in column A. It used to work perfectly before, but now when I run it all of the pictures populate into the same cell. Can anyone help me figure out how to make sure it populates each row in the range instead?
Here is the code:
Sub InsertPhoto()
Dim i As Integer
Dim all_std As Integer
all_std = ActiveSheet.UsedRange.Rows.Count
On Error GoTo Close_Error
Dim x As Integer
x = 2
For i = x To all_std + 1
Cells(i, 2).Select
ActiveSheet.Pictures.Insert( _
"S:\COMMON-IBD\IBD-SHARED\Merchandising\APAC STYLE IMAGES\" & Cells(i, 1) & ".jpg").Select
Selection.ShapeRange.IncrementLeft 150
Selection.ShapeRange.IncrementTop 20#
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 55
Selection.ShapeRange.Width = 55
Selection.ShapeRange.Rotation = 0#
x = x + 1
Next i
Close_Error:
i = x
Resume Next
End Sub
Thanks in advance for your help
Bookmarks