Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On my worksheet I want to have hyperlink's to each individual file in a
folder called "cover". Is there a macro that could make this much easier for me to do? Thanks Greg |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Gregg
Try this First macro create a list with file names on the activesheet and the second one create the hyperlinks Sub test() Dim myFiles() As String Dim fCtr As Long Dim myFile As String Dim myPath As String 'change to point at the folder to check myPath = "c:\data" If Right(myPath, 1) < "\" Then myPath = myPath & "\" End If myFile = Dir(myPath & "*.xls") If myFile = "" Then MsgBox "no files found" Exit Sub End If 'get the list of files fCtr = 0 Do While myFile < "" fCtr = fCtr + 1 ReDim Preserve myFiles(1 To fCtr) myFiles(fCtr) = myFile myFile = Dir() Loop If fCtr 0 Then For fCtr = LBound(myFiles) To UBound(myFiles) Cells(fCtr, 1).Value = myPath & myFiles(fCtr) Next fCtr End If End Sub Sub test() Dim mycell As Range For Each mycell In Columns("A").Cells.SpecialCells(xlCellTypeConstant s) If mycell.Value < "" Then ActiveSheet.Hyperlinks.Add Anchor:=mycell, _ Address:=mycell.Value, TextToDisplay:=mycell.Value End If Next End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Greg B" wrote in message ... On my worksheet I want to have hyperlink's to each individual file in a folder called "cover". Is there a macro that could make this much easier for me to do? Thanks Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't make hyperlink function work for hyperlink to website | Excel Worksheet Functions | |||
Moving rows with Hyperlink doesn't move hyperlink address | Excel Discussion (Misc queries) | |||
Intra-workbook hyperlink: macro/function to return to hyperlink ce | Excel Discussion (Misc queries) | |||
Macro to Copy Hyperlink to another file as a HYPERLINK, not text... | Excel Programming | |||
reading html when hyperlink address not hyperlink text diplayed | Excel Programming |