Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Add Hyperlink to Cell


I'm trying to point to files and add a hyperlink to each cell. This is my
code.
Sub FindFiles()
Dim rng As Range
Dim lRow As Long
Dim Filename As Variant
Filename = Application.GetOpenFilename(FileFilter:="Excel File
(*.xls),*.xls", MultiSelect:=True)
If TypeName(Filename) < "Boolean" Then
Range("A1").Resize(UBound(Filename, 1) - LBound(Filename, 1) + 1).Value =
Application.Transpose(Filename)
End If

lRow = Range("A65536").End(xlUp).Row
Set rng = Range("A1:A" & lRow)
For Each c In rng
c.Hyperlinks.Add
Next

End Sub

It fails he
c.Hyperlinks.Add

Any idea why?

Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Add Hyperlink to Cell


Hi Ryan

Replace the below code

lRow = Range("A65536").End(xlUp).Row
Set rng = Range("A1:A" & lRow)
For Each c In rng
c.Hyperlinks.Add
Next


with

Dim lngRow As Long, lngLastRow As Long
lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For lngRow = 1 To lngLastRow
ActiveSheet.Hyperlinks.Add Range("A" & lngRow), Range("A" & lngRow)
Next

'If it is not the activesheet specify the sheet name...

If this post helps click Yes
---------------
Jacob Skaria


"ryguy7272" wrote:

I'm trying to point to files and add a hyperlink to each cell. This is my
code.
Sub FindFiles()
Dim rng As Range
Dim lRow As Long
Dim Filename As Variant
Filename = Application.GetOpenFilename(FileFilter:="Excel File
(*.xls),*.xls", MultiSelect:=True)
If TypeName(Filename) < "Boolean" Then
Range("A1").Resize(UBound(Filename, 1) - LBound(Filename, 1) + 1).Value =
Application.Transpose(Filename)
End If

lRow = Range("A65536").End(xlUp).Row
Set rng = Range("A1:A" & lRow)
For Each c In rng
c.Hyperlinks.Add
Next

End Sub

It fails he
c.Hyperlinks.Add

Any idea why?

Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Add Hyperlink to Cell


Amazing! Amazing!! Amazing!!!

Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Jacob Skaria" wrote:

Hi Ryan

Replace the below code

lRow = Range("A65536").End(xlUp).Row
Set rng = Range("A1:A" & lRow)
For Each c In rng
c.Hyperlinks.Add
Next


with

Dim lngRow As Long, lngLastRow As Long
lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For lngRow = 1 To lngLastRow
ActiveSheet.Hyperlinks.Add Range("A" & lngRow), Range("A" & lngRow)
Next

'If it is not the activesheet specify the sheet name...

If this post helps click Yes
---------------
Jacob Skaria


"ryguy7272" wrote:

I'm trying to point to files and add a hyperlink to each cell. This is my
code.
Sub FindFiles()
Dim rng As Range
Dim lRow As Long
Dim Filename As Variant
Filename = Application.GetOpenFilename(FileFilter:="Excel File
(*.xls),*.xls", MultiSelect:=True)
If TypeName(Filename) < "Boolean" Then
Range("A1").Resize(UBound(Filename, 1) - LBound(Filename, 1) + 1).Value =
Application.Transpose(Filename)
End If

lRow = Range("A65536").End(xlUp).Row
Set rng = Range("A1:A" & lRow)
For Each c In rng
c.Hyperlinks.Add
Next

End Sub

It fails he
c.Hyperlinks.Add

Any idea why?

Thanks,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

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 do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
script to hyperlink and reference a cell value in the hyperlink Natasha D. Excel Programming 5 May 17th 06 07:43 PM
How make hyperlink refer to cell content rather than cell address. Omunene Excel Discussion (Misc queries) 3 March 2nd 06 01:07 AM
Copy hyperlink from one cell to/as hyperlink in another cell YogS Excel Worksheet Functions 6 January 12th 06 11:57 PM
Using paste link infromation in cell to hyperlink to source cell? Wayne Excel Worksheet Functions 7 February 27th 05 07:38 PM


All times are GMT +1. The time now is 03: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"