NeedVBAh3lp
New Member
- Joined
- Feb 24, 2012
- Messages
- 8
I have an excel file that visually looks similar to a windows explorer view. So C203 has a folder name, and E204:E317 have the file name (next folder name is in C318). I would like to use VBA to create a hyperlink for everthing in column E (relative, but needs to reference the 'folder' listed above it in column C). I've been searching forums for a while and can't seem to get it quite right.
Here's what I have so far...
The problem is that "foldername" actually selects the cell and starts working there, instead of the range I orignally select. Ideally it would also continue through blank values. THANKS in advance for the help.
Here's what I have so far...
Code:
Sub CreateHyperlink()
Dim c
Dim FolderName
FolderName = ActiveCell.Offset(0, -2).Range("A1").Select
Selection.End(xlUp).Select
For Each c In Selection
ActiveSheet.Hyperlinks.Add Anchor:=c, Address:= _
FolderName & c.Value, TextToDisplay:=c.Value
Next c
End Sub
The problem is that "foldername" actually selects the cell and starts working there, instead of the range I orignally select. Ideally it would also continue through blank values. THANKS in advance for the help.