How to hyperlink a command button to a URL address in Excel?


The hyperlink is a type of feature using which users can create or develop clickable links in the Excel spreadsheet. In more precise terms it can be said that the hyperlink can be used for navigation purposes that is by using the Excel spreadsheet, the user can move from one document to a web link or any associated document. Navigation depends on the provided link. If a webpage link is provided then the user will be redirected to a new webpage, while if another document is linked with the user, then the sheet will move the user to the next document.

The next provided terminology is the command button. In Excel, the command button is a type of control object used to insert into a worksheet or a user form to create an interactive button. command buttons can be customized with text, icons, or images.

In this example, the user will learn the process of linking the URL address to the provided command button in the Excel sheet. First, a command button is inserted in the Excel and then a URL address is linked with the inserted command button. so, that whenever the user clicks on the command button, the user will be automatically redirected to the associated web page.

To understand the process of inserting hyperlink to a command button by using the URL address in excel.

Step 1

This article explains the method to add a hyperlink to a command button. To perform the required task will be using an empty Excel spreadsheet.

Step 2

After that will be inserting a command button into the URL. Click on the “Developer” tab, and then under the control tab, click on the “Insert” button. Further, go to the second Active X control, and select the first “Command Button”, snapshot for the same is provided below:

Step 3

Draw the required command button, by dragging the plus symbol generated by the user. A snapshot for the same is provided below:

Step 4

Use right−click with the created command button and click on the “Properties” button. A snapshot for the same is provided below:

Step 5

The above step will open a “Properties” dialog box. This dialog box contains two tabs, alphabetic and categorized. Among these two tabs, click on the second tab “categorized”. Then go to the caption label, and type the URL https://www.tutorialspoint.com/index.htm. Finally, press the “Enter” key. This will display the provided link to the command button, and creates a connection. Snapshot for reference is provided below:

Step 6

After that click on the red cross button provided in the properties dialog box. Snapshot for reference is provided below:

Step 7

After that go to the sheet tab, and use right click further to select the “View Code” option. A snapshot for the same is provided below:

Step 8

The above step will open the Microsoft Visual Basics for Applications dialog box. Snapshot for reference is provided below:

Step 10

In the above opened editor paste the below provided code for reference:

' define function name
Private Sub CommandButton1_Click()
' access active working
' with provided hyperlink
ActiveWorkbook.FollowHyperlink _
Address:=CommandButton1.Caption
' end of module definition
End Sub

Step 11

Snapshot for code is provided below for user reference:

Step 12

In step, will try to execute the written code, to execute the written code, user need to click on the “run” button. Snapshot for the same is provided below:

Step 13

The above step will automatically display the required webpage, to understand the implemented policy go to the excel sheet again and click on the inserted control button.

Step 14

The above step will redirect the user to the linked webpage. Snapshot for reference is provided below:

Conclusion

In this article, the user will learn the process of using adding a hyperlink to a command button in Excel. This article contains a stepwise explanation for the process to understand how users can use a hyperlink command button, to navigate to any specific URL.

Updated on: 25-Jul-2023

264 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements