Macro to pull multiple images from folder to multiple sheets by image/sheet name

MrSTruct

New Member
Joined
Jul 10, 2020
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello all, happy to be a new member here and looking forward to becoming an active member of the community.

Here's my problem:

I have a workbook that contains 230 sheets which are essentially forms that are pulling data from the first master sheet. Each sheet is named after a specific reference number.
Now, I also have a folder that contains pictures that are named by the relevant reference number as well.

I want to create a macro that will pull the relevant picture to the corresponding sheet. The macro can either read the sheet name or a cell inside each sheet (the ref no can be found inside the sheet too) to determine which photo to pull.

All pictures are/will be resized to the exact dimension I need them to be and the cell will be exactly the same in every sheet.

You can see in the attached image how the forms are and how I'd want them to be. ( I have to do the process two times, one for each pic)

I have run into multiple problems, so I believe it's better not to bother you with what I have done so far.



Your input will be greatly appreciated, as I am afraid i'll lose my sleep over this!

Thanks


Edit: Images removed by moderator at OP's request
 
Last edited by a moderator:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Cross posted Macro to pull multiple images from folder to multiple sheets by image/sheet name

While we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Cross posted Macro to pull multiple images from folder to multiple sheets by image/sheet name

While we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.

This makes so much sense, sorry for not providing the link initially. Thanks for your time.
 
Upvote 0
@MrSTruct
Welcome to the MrExcel board!

I have removed the images from post #1 as requested. However, this will make it very hard for anybody to help. If you still need help perhaps you could reply here and post some images with 'dummy' data to demonstrate your problem. If you don't need help a post saying so would also be appreciated.
 
Upvote 0
@Peter_SSs Thanks, the question has been resolved on the other forum ( link posted by fluff above). Please mark it as solved?

For everyone's information , below is what I used and worked flawlessly for a batch import of 2x250 pictures at 2 exact same locations in 250 sheets at once.

Code for same file type (code for different file-types on thread above):

VBA Code:
Sub Same_Type()
Dim i As Long
    For i = 1 To ActiveWorkbook.Sheets.Count
        Sheets(i).Shapes.AddPicture _
            fileName:="C:\Picture Folder\" & Sheets(i).Name & ".jpg", _
            linktofile:=msoFalse, savewithdocument:=msoCTrue, _
        Left:=50, Top:=50, Width:=250, Height:=250
    Next i
End Sub
 
Upvote 0
Please mark it as solved?
We don't formally mark threads as solved as often an even better solution comes along later. What you have written is sufficient to let readers know that you are satisfied.
 
Upvote 0
@Peter_SSs Thanks, the question has been resolved on the other forum ( link posted by fluff above). Please mark it as solved?

For everyone's information , below is what I used and worked flawlessly for a batch import of 2x250 pictures at 2 exact same locations in 250 sheets at once.

Code for same file type (code for different file-types on thread above):

VBA Code:
Sub Same_Type()
Dim i As Long
    For i = 1 To ActiveWorkbook.Sheets.Count
        Sheets(i).Shapes.AddPicture _
            fileName:="C:\Picture Folder\" & Sheets(i).Name & ".jpg", _
            linktofile:=msoFalse, savewithdocument:=msoCTrue, _
        Left:=50, Top:=50, Width:=250, Height:=250
    Next i
End Sub
Hi Im new, I just read your solution here, can i get the sample file you used?
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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
Back
Top