excel courses, excel training

advance excel courses

Insert hyperlink automatically

Definition

By using VBA coding you can insert multiple macros automatically. This page will explain how to do it if you want to add hyperlinks to sheets in the same file.

Example

We will explain a simple example of linking 10 worksheetsThis will create the hyperlink from a summary sheet to the individual sheets. Download the following file for the example:

Make sure your macros are enables, otherwise it will not work.

The following screen will be shown:

insert-hyperlink

All the sheets is also there.

The code explained

Sub Macro1()
'
' Macro1 Macro
'
c = 1 ' declare variable called c

Do Until c = 11 ' loop will run 10 times s

d = Range("b" & c)
r = "'" ' used in next variable
a = "'" & Range("a" & c) & "'!a1" 'area to link to
b = Range("a" & c) 'name of hyperlink
Range("a" & c).Select ' select cell to do hyperlink in
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
a, TextToDisplay:=b 'add hyperlink
Range("a" & c).Select
c = c + 1 'start next loop

Loop

Using more sheets

You can manipulate the code, to add more sheets. If you cannot do this, contact us, and we can help you.

 

 

 

 

 

Home | Testimonials | Terms & Conditions | Contact Us | Courses | Manuals | Sitemap | Articles |