Skip to main content

How to display images from a range of file paths in Excel?

If you have a list of image file paths, now, you want to display the corresponding images in adjacent column based on the file paths to get the following screenshot result. How could you solve this job in Excel quickly and easily?

Display images from a range of file paths with VBA code in Excel

Display images from a range of file path with an amazing feature


Display images from a range of file paths with VBA code in Excel

Here, I can introduce a VBA code to help you, please do as this:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Display images from a range of file paths:

Sub InsertPicFromFile()
    Dim xRg As Range
    Dim xCell As Range
    Dim xVal As String
    On Error Resume Next
    Set xRg = Application.InputBox("Please select file path cells:", "KuTools for Excel", Selection.Address, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    For Each xCell In xRg
        xVal = xCell.Value
        If xVal <> "" Then
            ActiveSheet.Shapes.AddPicture xCell.Value, msoFalse, msoTrue, _
            xCell.Offset(0, 1).Left, xCell.Top, xCell.Height, _
            xCell.Height
        End If
    Next
    Application.ScreenUpdating = True
End Sub

3. After inserting the above code, please press F5 key to run this code, and a prompt box is popped out to remind you select the cells of the file path, see screenshot:

4. Then click OK button, all images based on corresponding file paths have been displayed into next column as following screenshot shown:


Display images from a range of file path with an amazing feature

If you are troubled with the above code, Kutools for Excel supports a handy feature - Insert Pictures from Path(URL), with this powerful utility, you can quickly insert the images based on file pathes or Url addresses at once.

Tips:To apply this Insert Pictures from Path(URL) feature, firstly, you should download the Kutools for Excel, and then apply the feature quickly and easily.

After installing Kutools for Excel, please do as this:

1. Click Kutools > Insert > Insert Pictures from Path(URL), see screenshot:

2. In the Insert Pictures from Path(URL) dialog box, please do the following operations:

  • Select the list of cells which contain the file path and a cell where you want to put the image;
  • Then, specify the size of the picture that you want to use under the Picture Size section.

3. Then, click Ok button, the corresponding images have been inserted into the cells, see screenshot:

Click Download Kutools for Excel and free trial Now!


More relative articles:

  • Convert Image URLs To Actual Images In Excel
  • If you have a list of image URL addresses in column A, and now, you want to download the corresponding pictures from the URLs and display them into the adjacent column B as left screenshot shown. In Excel, how could you extract the actual pictures from the image URLs quickly and easily?
  • Extract Hyperlinks From Multiple Images In Excel
  • Let’s say, you have a list of images in a worksheet, and each image contains a hyperlink, now, you would like to extract the real hyperlink addresses from these pictures to their next cells as following screenshot shown. Of course, you can copy the hyperlink address from the Edit Hyperlink box one by one, but, this will be time-consuming if there are multiple hyperlinks needed to be extracted.
  • Create Drop Down List With Images In Excel
  • In Excel, we can quickly and easily create a drop down list with cell values, but, have you ever tried to create a drop down list with images, that is to say, when you click one value from the drop down list, its relative image will be displayed at the same time.

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (1)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have a question - this VBA code is working for me (Excel 365 Mac v16.40), but it does not load the images into Excel until I import them all manually (and then delete them). Prior to my manual import, the script runs and then completes without an error, but without any images appearing. It's almost as if Excel can't see the destination path until I have made the path "visible" through the manual import.
Any thoughts as to what is happening here/how to solve without this workaround? Thanks!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations