Bulk-Creating hyperlink code in VBA Excel (connecting sheet in the current document)

Source: Internet
Author: User

In Excel, you create the hyperlink code in bulk (connect to sheet in the current document), and in column B in Sheet1, you create a series of hyperlinks that are the other sheet in this document, such as creating a macro under Sheet1 code as follows.

SUB Macro 1 ()

Dim Temp, Temp2

Dim I, J

j = 1

For i = 5 to 74

temp = "' G" & J & "'! A1 "

Temp2 = "G" & J

Range ("B" & i). Select

ActiveSheet.Hyperlinks.Add anchor:=selection, address:= "", Subaddress:=temp, texttodisplay:= "G" & J

j = j + 1

Next

End Sub

In the first cell of each sheet, create a linked cell that returns the column B of the Sheet1.

SUB Macro 2 ()

Dim temp, Temp2, I, J

j = 1

For i = 5 to 74

temp = "sheet1! B "& I

Temp2 = "G" & J

Sheets (TEMP2). Select

ACTIVECELL.FORMULAR1C1 = ""

Range ("A1"). Select

ActiveSheet.Hyperlinks.Add anchor:=selection, address:= "", Subaddress:=temp, texttodisplay:= "Back"

j = j + 1

Next

End Sub

Bulk-Creating hyperlink code in VBA Excel (connecting sheet in the current document)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.