VBA: Auto Insert Hyperlinked Photos and Resize

NeoSez

Board Regular
Joined
Aug 14, 2020
Messages
246
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I found a script for inserting hyperlinked photos that works well with one column.
However, I would like to know how to insert for multiple columns like I, J, K, L, M, N.
Each column will have several rows of hyperlinks.
Here is the code I found that works well for single column.
Just need to tweak it for multiple columns.
Thank you!

VBA Code:
Sub InstallPictures()

    Dim i As Long, v As String, Pic

    On Error Resume Next

    For i = 1 To 1903

        v = Cells(i, "G").Value

        If v = "" Then Exit Sub
        End If

            Set Pic = ActiveSheet.Pictures.Insert(v)

            With Pic

            .LockAspectRatio = msoFalse

            .Width = 100

            .Height = 100

            .Left = Cells(i, "h").Left + Cells(i, "h").Left.Width / 2 - .Width / 2

            .Top = Cells(i, "h").Top + Cells(i, "h").Height / 2 - .Height / 2

            End With

    Next i

    On Error GoTo 0

End Sub
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,224,814
Messages
6,181,126
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