Technology

Instructions on how to insert image links into Excel

Quoc Duong DNUM_BIZADZCACF 14:51

Inserting an image link into Excel will help viewers quickly navigate to the website containing the image if they click on the link. You can also insert one or more images into an Excel cell when you need to make a list with images.

Instructions on how to insert a link into an existing image in Excel

Step 1:To insert an image link into Excel, first you need to open the website containing the image you need to insert the link into Excel. Then right-click on that image and selectCopy image address.

Step 2:Next, open the Excel file where you want to insert the image link. Then right-click on the location where you want to insert the image link. When the scroll bar appears, select the itemLink.

Step 3:At this time, the Insert Hyperlink dialog box appears. Click on the itemExisting File or Web Page. Then go to the side menu column and click on the itemBrowsed PagesNow you need to paste the copied image link into the section.Address. After entering, pressOKto proceed to insert image link.

Step 4:After successfully inserting the link, move the mouse to the cell where the link was inserted and the image path will appear.

If you want to open that image, just left click on that link. The website containing that image will be opened quickly.

Instructions on how to insert image links into Excel using VBA

Press Alt + F11 to open the Visual Basic for Applications (VBA) Editor.

Go to Insert > Select Module.

Enter the following VBA code into the new module:

Sub InsertImageFromURL() Dim ws As Worksheet Dim imageURL As String Dim pic As Object Dim rng As Range ' Select the sheet and cell containing the image URL Set ws = ActiveSheet Set rng = ws.Range("A1") ' Replace A1 with the cell containing the image link ' Get the image link from the cell imageURL = rng.Value ' Check if the cell has a valid URL If imageURL = "" Then MsgBox "The cell does not contain an image link!", vbExclamation, "Error" Exit Sub End If ' Add a picture to Excel Set pic = ws.Pictures.Insert(imageURL) ' Align the image size according to the cell With pic .ShapeRange.LockAspectRatio = msoFalse .Left = rng.Left .Top = rng.Top .Width = rng.Width .Height = rng.Height End With ' Free up memory Set pic = Nothing Set ws = Nothing Set rng = Nothing End Sub

Put the image link in cell A1 (or another cell, but you have to change rng = ws.Range("A1") in the code).

Back in the Excel window, press Alt + F8, select InsertImageFromURL, and then press Run.

The image will be automatically downloaded and displayed in cell A1.

This VBA code works on Excel 2016 and above.

If you want the image to automatically display when you enter a link, you can assign a macro to Worksheet_Change to run automatically.

Featured Nghe An Newspaper

Latest

x
Instructions on how to insert image links into Excel
POWERED BYONECMS- A PRODUCT OFNEKO