Automating "Place in Cell" for Pictures Inserted in Excel Using VBA or Other Tools

latarshac

New Member
Joined
Feb 18, 2004
Messages
38
Office Version
  1. 365
Platform
  1. Windows
Hello Excel experts!

I’m currently working on a project that involves inserting images into Excel sheets. I use Kutools' "Insert Pictures from Path (URL)" feature to quickly add images from URLs or file paths into my workbook. While this feature works great, it inserts all images as "Place Over Cell," requiring me to manually click each image, then go to the menu and select "Place in Cell."

The Problem:
This manual process is extremely time-consuming, especially when dealing with hundreds of images. I’d like to automate the process so that:​

1. The script checks if the URL column (D) is not blank.
2. For each corresponding image inserted in column (B), it ensures the image is placed in the cell rather than over it.

Desired Outcome:
All images should fit within their respective cells (B), and adjust automatically when rows or columns are resized.​

Current Setup:
Kutools to insert pictures from URLs in column (B)​
URL references are stored in column (D)​

What I’ve Tried:
I looked into some VBA solutions but haven’t found a clear method to programmatically replicate the "Place in Cell" option for pictures.​

Request:
Does anyone know a VBA script or another tool/approach to automat~e this task?​
Any resources or examples would be greatly appreciated!​


Thanks in advance for your help!
Tarsha
 

Attachments

  • 20241130_161426 - Screenshot_Captor_v4.36.2_-_DScreenshotCaptorScree - Screenshot.png
    20241130_161426 - Screenshot_Captor_v4.36.2_-_DScreenshotCaptorScree - Screenshot.png
    91.5 KB · Views: 1

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
The so called empty cells need to be genuinely empty
Code:
Sub Maybe()
Dim c As Range
    For Each c In Range("D2:D" & Cells(Rows.Count, 4).End(xlUp).Row)
        If Len(c) <> 0 Then
            ActiveSheet.Shapes.AddPicture c.Value, False, True, c.Offset(, -2).Left, c.Offset(, -2).Top, c.Offset(, -2).Width, c.Offset(, -2).Height
        End If
    Next c
End Sub
How to change size when changing column width and row height after the pictures are brought in needs to be added.
 
Upvote 0

Forum statistics

Threads
1,224,309
Messages
6,177,794
Members
452,806
Latest member
Workerl3ee

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