Inserting Multiple Pics Into Set Destination Cells - Part 2

dpearson15

New Member
Joined
Sep 12, 2006
Messages
6
A few days ago I received an excellent solution to a problem I had where I needed to insert a series of pictures into an Excel worksheet, & then use a macro to automatically move these pictures to set locations within the worksheet. The photos move to cells A5, A25, A45, etc., in increments of 20.

Here’s the original text of the posting:
I'm using a template to report on progress at a construction site. The format is a photo with a comment, with a total of 24 photos to each worksheet. I've inserted the photos, which I now need to move to set cells within the sheet. The first inserted photo will always be moved to cell A5, the second photo inserted to cell A25, etc., regardless of which set of 24 photos are inserted. Is there any way to set up a macro that will automatically move the photos from the point of insert to the correct destination cells? That way I don't have to move the photos manually each time.
--

As I said, the code I was provided worked perfectly. However, now I've been asked to change the format of my worksheet so that the macro always moves the pictures to the following cells, in order: A1, G1, A20, G20, A39, G39. Can someone please let me know what code would be used for this? I really appreciate any assistance you can provide!!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,887
Hi Diane

I've changed the code. Please try:

Code:
Sub PlacePictures()
Dim shp As Shape, lRow As Long, lCol As Long

lRow = 1: lCol = 1
With Worksheets("Sheet1")
    For Each shp In .Shapes
        shp.Left = .Cells(lRow, lCol).Left
        shp.Top = .Cells(lRow, lCol).Top
        If lCol = 1 Then
            lCol = 7
        Else
            lCol = 1
            lRow = lRow + 19
        End If
    Next shp
End With

End Sub

Hope this is what you need
PGC
 

dpearson15

New Member
Joined
Sep 12, 2006
Messages
6
Many Thanks

Greetings,
This new code again gave me just exactly what I needed. Thank you so much for this! I appreciate the quick response to my question.
Thanks again,
Diane
 

Forum statistics

Threads
1,171,203
Messages
5,874,330
Members
433,044
Latest member
drewbizzy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top