Thursday 11 August 2011

VBA Excel Macro for Hyperlinking first column

Use this macro in an excel 2010 spreadsheet to turn the first column of a table into hyperlinks, using the text of the table as a hyperlink.

Sub CreateLinks()
'
' CreateLinks Macro
'
' Keyboard Shortcut: Ctrl+R
'
   
    Dim i As Integer

    'Starting on row 2 because I have a header.
    Range("A2").Select
   
    'move to the final cell in the first column
    ActiveCell.End(xlDown).Select
       
    Do Until ActiveCell.Row = 1
   
        ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
           ActiveCell.Text, TextToDisplay:= _
           ActiveCell.Text, ScreenTip:= _
           "Click here to open Person record in Beacon"
               
        Range("A" & ActiveCell.Row - 1).Select
       
    Loop
   
   
End Sub

No comments:

Post a Comment

How to find the last interactive logons in Windows using PowerShell

Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...