Quickly export excel hyperlinks in batches


background

Recently, I encountered a problem of exporting hyperlinks in batches from a certain column in an excel table. After checking the information and trying it out, I found a simple and feasible method, and now I will share it with you.

test form

The excel table we tested looks like this:
Insert image description here

Steps

Step 1: Select the cells or rows to be exported and click the menu Tools->Macro->Visual Basic Editor

Insert image description here

Step 2: Click the menu Insert->Module in the opened Visual Basic editor

Insert image description here

Step 3: Copy the following code into the module text box just created, as shown in the figure below

Sub ExtractHL()
Dim HL As Hyperlink
For Each HL In ActiveSheet.Hyperlinks
HL.Range.Offset(0, 1).Value = HL.Address
Next
End Sub

Insert image description here

Step 4: Click the blue triangle in the picture above, and click the "Run" button directly in the pop-up window to export the hyperlink of the selected area.

Insert image description here
Insert image description here

Notice

I use excel under a mac system to take demonstration screenshots. If it is a windows system, the menus and operations may be slightly different, but the overall process and code will not change.

Reference 1

Guess you like

Origin blog.csdn.net/gongchenyu/article/details/126234626