It is common to create lists of links in Excel, such as websites, files, or shortcuts to other sheets. However, clicking these links one by one can be time-consuming.
This article introduces a method using VBA to automatically open all hyperlinks in the active sheet at once.
目次
Uses and Purposes
- Opening a list of web links all at once.
- Checking links efficiently.
- Automatically opening multiple files to verify them.
VBA Code Example
Running the code below will open all hyperlinks in the currently active sheet in order.
Sub OpenAllHyperlinks()
Dim linkItem As Hyperlink
' Loop through all hyperlinks in the active sheet
For Each linkItem In ActiveSheet.Hyperlinks
' Open the link destination
linkItem.Follow
Next linkItem
End Sub
Code Explanation
- ActiveSheet.Hyperlinks: This targets all hyperlinks on the currently active sheet.
- linkItem.Follow: This is the standard method to open a hyperlink. It works for web links, file paths, and internal sheet links.
Important Notes
- Browser Tabs: If you have many website URLs, your browser will open them in separate tabs. Opening too many at once might slow down your computer.
- Confirmation Dialogs: For file links, you might see a security warning dialog depending on your settings and file types.
- System Load: Be careful when opening many links at once, as it can increase the load on your system.
Summary
By using VBA, you can automatically open all hyperlinks in an Excel sheet.
This technique is very effective for automating simple, repetitive tasks like checking links or opening daily web pages. Use this code to save time and improve your efficiency.
