Do you need to add a hyperlink to your Excel sheet?
A hyperlink can direct you to any web page from your Excel workbook with the click of your mouse. You can also use a hyperlink to get directed to another sheet or even to start a new email!
This post examines all the ways to insert a hyperlink in Microsoft Excel with examples. Get your copy of the example workbook used in this post to follow along.
Insert a Hyperlink from the Insert Tab
One popular way to insert a hyperlink is through the Insert tab.
Add a Hyperlink to a Website
The first example above will be a hyperlink to the How To Excel website.
- Select the cell that you want to be hyperlinked.
- Go to the Insert tab.
- Select the Link command.
- On the Insert Hyperlink menu, type a description in the Text to display field which will become your cell content.
- Click the ScreenTip button for a more detailed description that will appear when you hover over your hyperlink.
- Type a description into the ScreenTip text field and click the OK button.
https://www.howtoexcel.org/
- Ensure you have the Existing File or Web Page option selected on the left.
- Paste the above website address into the Address field.
- Click the OK button.
A hyperlink now appears in your cell. Hover over your cell and notice that your screen tip appears.
Click your hyperlink and the browser opens up to the How To Excel website!
Add a Hyperlink to Another Sheet
Now try creating a hyperlink that will direct you to another sheet within the workbook.
- Select a cell that you’ll be hyperlinking from.
- Go again to the Insert tab and select the Link command.
- Optionally provide a ScreenTip text as before.
- Now select Place in This Document along the left.
- Under Cell Reference select the sheet you’ll hyperlink to.
- Type a specific cell reference under Type the cell reference. This will become the active cell when you hyperlink to your sheet.
- Click the OK button.
- Test your work by clicking the new hyperlink and notice how you get directed to the other sheet!
Add an Emailto Hyperlink
The last example will hyperlink to a new email message for a specified recipient:
- Select a cell that you want hyperlinked.
- Go again to the Insert tab and select Link.
- Optionally provide a ScreenTip text… as before.
- Now select E-mail Address along the left.
- Under E-mail address type your recipient’s address
- Describe your message content in the Subject field and click OK.
- See your hyperlink in action by clicking it.
A new email appears and is addressed to your recipient! The email program that launches depends on the default setup in Windows Mail.
Insert a Hyperlink from the Right Click Menu
Using the right button on your mouse is an alternative way of reaching the same Insert Hyperlink menu.
You can create a hyperlink from the right-click menu with these steps.
- Right-click the cell that you want hyperlinked.
- Select the Link option.
This will open the same Insert Hyperlink menu seen previously and you can create any type of link.
Insert a Hyperlink with a Keyboard Shortcut
One other way to reach the same Insert Hyperlink menu is through a keyboard shortcut.
- Select your cell to be hyperlinked.
- Press Ctrl + K on your keyboard.
This is a super quick way to launch the same Insert Hyperlink menu.
Insert a Hyperlink with the HYPERLINK Function
Excel provides a dedicated HYPERLINK function that provides similar options as the Insert Hyperlink menu.
Here’s how to use HYPERLINK function to link to a web page.
= HYPERLINK( "http://www.howtoexcel.org/", "How To Excel" )
Select a cell to hyperlink from and add the above formula into the formula bar.
The first argument "http://www.howtoexcel.org/"
is the web address where you’ll be directed to.
The second argument "How To Excel"
determines what will display in the cell. Surround both arguments with quotes ("
) because Excel expects them to be text.
Press Enter to calculate your formula and test your hyperlink by clicking the cell!
To use the HYPERLINK function to link to another sheet within the workbook, the syntax is slightly different.
= HYPERLINK( "#'Sheet2'!A1", "Go to Sheet2" )
The above formula creates a hyperlink to the cell A1 of the sheet named Sheet2. The pound (#
) is necessary to indicate that the link is within the current workbook.
Another slight variation of the HYPERLINK function will launch a new email to a specified recipient.
= HYPERLINK( "mailto:johndoe@howtoexcel.com" , "Email Me")
The above formula requires mailto:
at the start of the first argument to indicate you want to create an email link. The example recipient johndoe@howtoexcel.com
is also included in the first argument.
Insert a Hyperlink with a Right Click and Drag
The right-click and drag method of inserting a hyperlink is unique because you are starting from the destination of the hyperlink rather than its source. You are essentially pasting the navigation onto your source cell.
Follow these steps to insert a hyperlink between two cells using right click and drag method.
- Ensure you have your workbook saved so that Excel can properly form the hyperlink.
- Hover over the edge of your destination cell until the cursor displays a 4-way arrow.
- Right click and drag to the cell where you want your hyperlink created and release the button. This will show you a menu with various cut, copy, and paste options.
- Select the Create Hyperlink Here option.
Your hyperlink appears and the cell content of both cells looks similar.
Click the hyperlink and note how you are directed to your destination cell!
💡 Tip: You may also use this technique to hyperlink between two workbooks.
Insert a Hyperlink with VBA
VBA is great at automating Excel tasks, including those involving hyperlinks!
Suppose you have your sheet names in a range of cells. You can use VBA to convert those sheet names into hyperlinks so that you can be directed to those sheets.
Open the VBA Editor by pressing Alt + F11 or selecting Visual Basic under the Developer tab. You may need to enable the Developer tab since it is hidden by default.
Go to the Insert menu and select Module.
Sub InsertHyperLinks()
Dim sheet
Dim link_location
Dim friendly_name
For Each sheet In Selection.Cells
link_location = "#'" & sheet & "'!A1"
link_location = """" & link_location & """"
friendly_name = """" & sheet.Value & """"
sheet.Formula = "=HYPERLINK(" & link_location & "," & friendly_name & ")"
Next
End Sub
Double-click on the new module to open it and paste the above VBA code into that module.
The code loops through every selected cell and sets the hyperlink destination with the link_location
.
The hyperlink begins with a pound (#
) to indicate the current workbook. The friendly_name
is what displays in the hyperlinked cell.
Both arguments are surrounded by double quotes ("
) and passed to the HYPERLINK function for conversion.
Try out your code by going back to your sheet and selecting your range of sheet names.
Go to the View tab and select Macros.
Select your InsertHyperLinks macro and click the Run button.
This runs the code and adds hyperlinks to the selected range. Clicking on the hyperlinks brings you to cell A1 of the respective sheet!
Insert a Hyperlink with Office Scripts
Office Scripts is the automation language for Excel for the web and is available to you if you have a Microsoft 365 Business Plan.
You can convert a range of sheet names into hyperlinks using Office Scripts.
Go to your browser and open your workbook in Excel for the web.
Select the Automate tab and then click on the New Script command. Ensure you have a Microsoft 365 Business Plan if you don’t see the Automate tab.
function main(workbook: ExcelScript.Workbook) {
let range = workbook.getSelectedRange();
let rowCount = range.getRowCount();
let colCount = range.getColumnCount();
for (let row = 0; row < rowCount; row++) {
for (let col = 0; col < colCount; col++) {
let currCell = range.getCell(row, col);
let linkedSheetName = currCell.getValue();
currCell.setHyperlink({
textToDisplay: linkedSheetName.toString(),
documentReference: `${linkedSheetName}!A1`
});
};
};
}
Paste the above script into the Code Editor.
The script loops through each currCell
cell in the selected range.
linkedSheetName
is the sheet name to be displayed in the cell. `${linkedSheetName}!A1`
is the A1 cell destination of the respective sheet.
Test your script by selecting a range of sheet names and clicking Run in the Code Editor.
The cells change to hyperlinks that direct to their respective sheets!
Conclusions
You’ve seen multiple ways to insert hyperlinks in Microsoft Excel.
The most basic way is with the Insert tab but you can achieve the result a little quicker using the right-click menu or keyboard shortcut.
The right-click and drag method is typically used when hyperlinking between workbooks or within the same sheet in a workbook.
The HYPERLINK function is particularly effective at creating hyperlinks either manually through the formula bar or dynamically through VBA code.
For a workbook in Excel for the web, Office Scripts offers you flexibility similar to VBA when inserting hyperlinks.
Have you ever added hyperlinks to your workbook? How did you create the links? Let me know in the comments!
How can I add a hyperlink to selected text only, and not to the entire cell? for example, if the cell contains text saying “Refer to Appendix B for further information” I only want the hyperlink on “Appendix B”.
Unfortunaly, I don’t think that’s possible.