How to Create a Hyperlink in Excel Spreadsheet Using VBScript

Someone at the newsgroup asked this question. This is the VBScript that I wrote to accomplish this.

If you’re thinking about purchasing a new GPU, we’d greatly appreciate it if you used our Amazon Associate links. The price you pay will be exactly the same, but Amazon provides us with a small commission for each purchase. It’s a simple way to support our site and helps us keep creating useful content for you. Recommended GPUs: RTX 5090, RTX 5080, and RTX 5070. #ad

Dim objExcel

Set objExcel = WScript.CreateObject("Excel.Application")



objExcel.Visible = TRUE

objExcel.Workbooks.Open "C:\\bintest.xls"

objExcel.Workbooks(1).Activate

objExcel.Workbooks(1).Worksheets(1).Range("A1").Select



Dim sLinkAddress

sLinkAddress = "http://www.google.com"



objExcel.Workbooks(1).Worksheets(1).Hyperlinks.Add _

    objExcel.Selection, sLinkAddress

objExcel.Workbooks(1).SaveAs "C:\\bintest.xls"

objExcel.Quit



set objExcel = nothing

6 Comments

  1. hi,

    I am trying to create a worksheet wherein you enter the web address of a site say ex: http://www.xyz.com and upon entering the value, the cell should display only “XYZ” and not the entire web address. Upon clicking that cell, it should take us to that site.

    Can you please suggest some ways to do this?

    Thanks …

Leave a Reply