Adding hyperlinks using vba

haggisuk

New Member
Joined
Jan 26, 2008
Messages
10
Hi Folks,

I am trying to make a workbook that will basically be a document index to files on a network drive.

So what i wish to be able to do is have a button on the worksheet that will check for the next empty cell in a coloum and then open a browse window so i can look for a file on the network and then once i have selected the paticular file populate the next empty cell with the hyperlink to the file.

I can do the required tasks manually but i would like it run from a macro/vba sub

I tried to do it using a macro record sequence but cant get it to work.

Any ideas?

Thanks

Del
 
Last edited:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi,

Something like this maybe:

Code:
Sub test()
    Dim strFileName
    strFileName = Application.GetOpenFilename("All Files (*.*), *.*")
    If strFileName = False Then Exit Sub
    Sheets("Sheet1").Hyperlinks.Add Anchor:=Range("A" & Rows.Count).End(xlUp).Offset(1, 0), _
        Address:=strFileName, TextToDisplay:=strFileName
End Sub


Dom
 
Upvote 0
I have modified your code but works great for my needs

Sub Macro2()
Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select
Application.Dialogs(xlDialogInsertHyperlink).Show


End Sub


Thanks again for your help.

Del
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,424
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top