help whit hyperlink

D

Didier Lizard

Hi !

In the range a1:a100 I have a list of song's title.
In range b1:b100 I have the file's name.

The question is how in VBA I can give this file name added to the dir name
as an hyperlink of the song title ?
So if I clik on that song it goes on playing.

I've tried something like that

dirname="c:\mySongs\"
for i=1 to 100
worksheets(sheet1).range("a1:a100").hyperlinks(i).Subaddress=dirname &
worksheets(sheet1).cell("b" & i)
next i

but it does not work

Thanks tou you

Didier
 
D

Don Guillett

Perhaps a DOUBLE click one liner would be of some help
right click sheet tab>view code>paste this>save workbook.
assumes you are clicking on a cell with the full file name without .mp3 at
end
you will get C:\yourfolder\yourfilename.mp3
If you have .mp3 at the end, simply delete the &".mp3" part

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
ActiveWorkbook.FollowHyperlink Address:= _
"C:\yourfolder\" & ActiveCell & ".mp3"
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top