Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Find the row for a Hyperlink

I have a web query that imports a table with both text and
hyperlinks. What I need is the row number of each cell that has a
hyperlink and the URL for it.

I know how to read the cells that I want using: For Each rangeX In
Sheets("x").Range("A1:G7")
but I can not figure out how to determine the cells that have
hyperlinks.

I can also read the page using the following: For Each hyperX In
Sheets("x").Hyperlinks
but I can not figure out how to determine the worksheet row/col of the
hyperlink.

Any suggestions? (using WinXP and both XL2003 & XL2007)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Find the row for a Hyperlink

On Fri, 16 Dec 2011 15:04:03 -0800 (PST), cubbybear3 wrote:

I have a web query that imports a table with both text and
hyperlinks. What I need is the row number of each cell that has a
hyperlink and the URL for it.

I know how to read the cells that I want using: For Each rangeX In
Sheets("x").Range("A1:G7")
but I can not figure out how to determine the cells that have
hyperlinks.

I can also read the page using the following: For Each hyperX In
Sheets("x").Hyperlinks
but I can not figure out how to determine the worksheet row/col of the
hyperlink.

Any suggestions? (using WinXP and both XL2003 & XL2007)


In xl2007 (I don't know about xl2003), you can get the row from

hyperX.range.row

and the column from

hyperX.range.column.


To get the cell address:

======================
Option Explicit
Sub GetHyperlinkAddress()
Dim hls As Hyperlinks, hl As Hyperlink
Dim v()
Set hls = Worksheets("sheet1").Hyperlinks
For Each hl In hls
Debug.Print hl.Name, Cells(hl.Range.Row, hl.Range.Column).Address
Next hl
End Sub
============================

If you put a breakpoint at "next hl" and add a watch for hl, you can discern all types of interesting information from the watch window.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Find the row for a Hyperlink

On Fri, 16 Dec 2011 15:04:03 -0800 (PST), cubbybear3 wrote:

I have a web query that imports a table with both text and
hyperlinks. What I need is the row number of each cell that has a
hyperlink and the URL for it.

I know how to read the cells that I want using: For Each rangeX In
Sheets("x").Range("A1:G7")
but I can not figure out how to determine the cells that have
hyperlinks.

I can also read the page using the following: For Each hyperX In
Sheets("x").Hyperlinks
but I can not figure out how to determine the worksheet row/col of the
hyperlink.

Any suggestions? (using WinXP and both XL2003 & XL2007)


Of course, to get just the address that the hyperlink is attached to, you can more simply use:

hl.range.address

Also see HELP for the members of the hyperlink object.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Find the row for a Hyperlink

Thanks Ron,

Is there any way to identify the Hyperlink using the 1st method
(For Each rangeX In Sheets("x").Range("A1:G7")?

-pb
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Find the row for a Hyperlink

On Fri, 16 Dec 2011 17:17:42 -0800 (PST), cubbybear3 wrote:

Thanks Ron,

Is there any way to identify the Hyperlink using the 1st method
(For Each rangeX In Sheets("x").Range("A1:G7")?

-pb



For Each rangeX in ...
If rangeX.Hyperlinks.Count 0 Then
Debug.Print rangeX.Address, rangeX.Hyperlinks(1).Address
End If
next rangeX


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Find the row for a Hyperlink

Again, thank you Ron.
-pb

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Find the row for a Hyperlink

On Mon, 19 Dec 2011 16:15:20 -0800 (PST), cubbybear3 wrote:

Again, thank you Ron.
-pb


Glad to help. Thanks for the feedback.
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 can i Hyperlink the 'find' button? ComputerUser123 Excel Discussion (Misc queries) 2 February 22nd 10 05:11 PM
find and replace within a hyperlink DebC Excel Discussion (Misc queries) 8 January 20th 09 07:18 PM
Find Error, Hyperlink.. nastech Excel Discussion (Misc queries) 0 July 12th 06 08:16 PM
Find Pictures and Hyperlink TimelessTreasuresVP Excel Discussion (Misc queries) 5 June 9th 05 02:03 AM
Using a hyperlink to find information on a different worksheet Tony Excel Programming 3 June 14th 04 03:38 PM


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