View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Campbell Mark Campbell is offline
external usenet poster
 
Posts: 16
Default Help Needed Creating Hyperlinks from a userform

Thks a7n9

Listbox is working a treat.

I have added the code to the enter button but it is not looping correctly -
i want to enter the file names as hyperlinks and am using the following code
- the first hyperlink is to be inserted in column 22 with the next in column
23 and so on -
Where am I going wrong? at present it just enters the last file selected
into column 22
' Transfer the hyperlinks

For i = 1 To mylistbox.ListCount
j = 22
ActiveSheet.Hyperlinks.Add Anchor:=Cells(nextrow, j),
Address:=mylistbox.List(i - 1)
j = j + 1
Next i

Also is it possible to show the filenames only without the paths being
visible?

Thanks for your help
"a7n9" wrote:


Hi,

You could create a listbox on your form, and keep adding the items from
the selection to that list box.

In your loop, you can add a simple line refering to your list box and
add the selected items by using the propery AddItem, for example,

For i = LBound(FileName) To UBound(FileName)
Msg = Msg & FileName(i) & vbCrLf
mylistbox.Additem FileName(i)
Next i

Then in the Enter button, copy the contents of the ListBox to the
worksheet using following loop:

For i = 1 to mylistbox.Listcount
j=12
Range("A" & j) = mylistbox.List(i-1)
j=j+1
Next i


--
a7n9


------------------------------------------------------------------------
a7n9's Profile: http://www.excelforum.com/member.php...o&userid=32149
View this thread: http://www.excelforum.com/showthread...hreadid=563262