VBA: Auto Insert Hyperlinked Photos and Resize

NeoSez

Board Regular
Joined
Aug 14, 2020
Messages
210
Office Version
  1. 2019
  2. 2010
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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,956
Latest member
JPav

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