#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default link list

Hi,

I have searched for macro to link list but I did not found it. There
are some to list files but they do not suit me.

I have list of names in column A and I would like to check if file
with that name exist in folder and if yes than I would like to add
hyperlink in column B to that file.

Any help appreciated.

Miha

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default link list

Look at the Dir command to see if a file exists.

YOu can see how to add a hyperlink by turning on the macro recorder, then
adding one manually. Turn off the macro recorder and look at the recorded
code. Then work that into your macro.

--
Regards,
Tom Ogilvy



"miha" wrote:

Hi,

I have searched for macro to link list but I did not found it. There
are some to list files but they do not suit me.

I have list of names in column A and I would like to check if file
with that name exist in folder and if yes than I would like to add
hyperlink in column B to that file.

Any help appreciated.

Miha


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default link list

I have following code. ELSE in IF does not work correct because I get
listed all files not just missing on the list.

Sub LinkList()
Dim ListName As String ' For List Name
Dim FileName As String ' For File Name
Dim MyFileLocation As String
MyFileLocation = "c:\Documents and Settings\msantovec\My Documents
\_work\ExcelLinkFiles\*.*" 'change to your needs
FileName = Dir(MyFileLocation)
Do Until FileName = ""
For i = 1 To [B65536].End(xlUp).Row
ListName = Cells(i, 2).Value
If FileName = ListName Then
Cells(i, 1).Value = FileName
' ActiveSheet.Hyperlinks.Add Anchor:=Range("A" & i),
Address:=FileName, TextToDisplay:=FileName
Exit For
Else
Cells(ActiveSheet.UsedRange.Rows.Count + 1, 1).Value =
FileName
' ActiveSheet.Hyperlinks.Add Anchor:=Range("A" &
[A65536].End(xlUp).Row + 1), Address:=FileName,
TextToDisplay:=FileName
Exit For
End If
Next i
FileName = Dir
Loop
End Sub


Tom Ogilvy je napisal:
Look at the Dir command to see if a file exists.

YOu can see how to add a hyperlink by turning on the macro recorder, then
adding one manually. Turn off the macro recorder and look at the recorded
code. Then work that into your macro.

--
Regards,
Tom Ogilvy



"miha" wrote:

Hi,

I have searched for macro to link list but I did not found it. There
are some to list files but they do not suit me.

I have list of names in column A and I would like to check if file
with that name exist in folder and if yes than I would like to add
hyperlink in column B to that file.

Any help appreciated.

Miha



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Link drop-down list? deepak Excel Discussion (Misc queries) 2 January 28th 09 10:07 AM
To Link drop-down list deepak Excel Discussion (Misc queries) 1 January 27th 09 12:50 PM
Link from a drop down list Jose L Guillen Excel Worksheet Functions 0 May 11th 08 10:57 PM
link words from one list to another and complete the list berna Excel Discussion (Misc queries) 5 December 24th 07 12:58 AM
How do I Link 1 List to Another jth Excel Discussion (Misc queries) 3 July 5th 05 04:09 AM


All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"