Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Reference cell address of Hyperlink

As I loop thru Hyperlinks, I need a reference to the active Hyperlink so I
can put a value in a cell Offset(0,7). See the first line following the
query

Option Explicit

Sub UpdateUsage()
Dim hyp As Hyperlink
Dim hypadr As String

For Each hyp In ActiveSheet.Range("K:K").Hyperlinks
hypadr = hyp.Address

With Worksheets("Update").QueryTables.Add(Connection:=" URL;" & hypadr _
, Destination:=Range("A1"))
.name = ""
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With

ActiveSheet.CurrentHyperlink.Offset(0, 7).Value = _
Worksheets("Update").Range("C7").Value ==this is not right

With Worksheets("Update")
'do some other stuff
.Rows("1:7").Delete shift:=xlUp
End With
Next hyp
End Sub

Mike F


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Reference cell address of Hyperlink

Mike,

hypadr = hyp.Range.Address
ActiveSheet.Range(hypadr).Offset(0, 7).Value =...
ought to do it.

Regards,
Jim Cone
San Francisco, USA


"Mike Fogleman" wrote in message
...
As I loop thru Hyperlinks, I need a reference to the active Hyperlink so I
can put a value in a cell Offset(0,7). See the first line following the
query
Option Explicit
Sub UpdateUsage()
Dim hyp As Hyperlink
Dim hypadr As String

For Each hyp In ActiveSheet.Range("K:K").Hyperlinks
hypadr = hyp.Address

With Worksheets("Update").QueryTables.Add(Connection:=" URL;" & hypadr _
, Destination:=Range("A1"))
.name = ""
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With

ActiveSheet.CurrentHyperlink.Offset(0, 7).Value = _
Worksheets("Update").Range("C7").Value ==this is not right

With Worksheets("Update")
'do some other stuff
.Rows("1:7").Delete shift:=xlUp
End With
Next hyp
End Sub

Mike F


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Reference cell address of Hyperlink

Not quite Jim, but I got it....

Sub UpdateUsage()
Dim hyp As Hyperlink
Dim hypadr As String
Dim hyprng As Range

For Each hyp In ActiveSheet.Range("K:K").Hyperlinks
hypadr = hyp.Address
Set hyprng = hyp.Range


Mike F
"Jim Cone" wrote in message
...
Mike,

hypadr = hyp.Range.Address
ActiveSheet.Range(hypadr).Offset(0, 7).Value =...
ought to do it.

Regards,
Jim Cone
San Francisco, USA


"Mike Fogleman" wrote in message
...
As I loop thru Hyperlinks, I need a reference to the active Hyperlink so I
can put a value in a cell Offset(0,7). See the first line following the
query
Option Explicit
Sub UpdateUsage()
Dim hyp As Hyperlink
Dim hypadr As String

For Each hyp In ActiveSheet.Range("K:K").Hyperlinks
hypadr = hyp.Address

With Worksheets("Update").QueryTables.Add(Connection:=" URL;" & hypadr _
, Destination:=Range("A1"))
.name = ""
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With

ActiveSheet.CurrentHyperlink.Offset(0, 7).Value = _
Worksheets("Update").Range("C7").Value ==this is not right

With Worksheets("Update")
'do some other stuff
.Rows("1:7").Delete shift:=xlUp
End With
Next hyp
End Sub

Mike F




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Reference cell address of Hyperlink

Mike,
Are you sure about... hypadr = hyp.Address ?
Jim Cone


"Mike Fogleman" wrote in message
...
Not quite Jim, but I got it....

Sub UpdateUsage()
Dim hyp As Hyperlink
Dim hypadr As String
Dim hyprng As Range

For Each hyp In ActiveSheet.Range("K:K").Hyperlinks
hypadr = hyp.Address
Set hyprng = hyp.Range


Mike F
"Jim Cone" wrote in message
...
Mike,

hypadr = hyp.Range.Address
ActiveSheet.Range(hypadr).Offset(0, 7).Value =...
ought to do it.

Regards,
Jim Cone
San Francisco, USA


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Reference cell address of Hyperlink

Yes, I am now. here is the working code:
Sub UpdateUsage()
Dim hyp As Hyperlink
Dim hypadr As String
Dim hyprng As Range
Dim mystr As String
Dim myval As String
Dim i As Long

For Each hyp In ActiveSheet.Range("K:K").Hyperlinks
hypadr = hyp.Address
Set hyprng = hyp.Range
With Worksheets("Update").QueryTables.Add(Connection:=" URL;" & hypadr _
, Destination:=Worksheets("Update").Range("A1"))
.name = ""
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.Refresh BackgroundQuery:=False
End With
mystr = Worksheets("Update").Range("A3").Value

i = Application.WorksheetFunction.Find(" ", mystr, 5)
i = i - 5
myval = Mid(mystr, 5, i)
hyprng.Offset(0, 7).Value = myval
With Worksheets("Update")
.Rows("1:7").Delete Shift:=xlUp
End With
Next hyp
End Sub

Mike F
"Jim Cone" wrote in message
...
Mike,
Are you sure about... hypadr = hyp.Address ?
Jim Cone


"Mike Fogleman" wrote in message
...
Not quite Jim, but I got it....

Sub UpdateUsage()
Dim hyp As Hyperlink
Dim hypadr As String
Dim hyprng As Range

For Each hyp In ActiveSheet.Range("K:K").Hyperlinks
hypadr = hyp.Address
Set hyprng = hyp.Range


Mike F
"Jim Cone" wrote in message
...
Mike,

hypadr = hyp.Range.Address
ActiveSheet.Range(hypadr).Offset(0, 7).Value =...
ought to do it.

Regards,
Jim Cone
San Francisco, USA




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
Coverting hyperlink cell to the web page address Roger on Excel Excel Discussion (Misc queries) 2 November 5th 07 08:20 PM
How to extract a web address from a hyperlink cell? El Rebelde Excel Discussion (Misc queries) 2 November 16th 06 04:44 PM
Keeping the hyperlink address hidden in a cell. rholmes via OfficeKB.com Excel Worksheet Functions 7 June 17th 06 01:56 AM
How make hyperlink refer to cell content rather than cell address. Omunene Excel Discussion (Misc queries) 3 March 2nd 06 01:07 AM
how do I add a 'web address' to a cell in excel with a hyperlink? sandie white New Users to Excel 1 February 8th 06 01:30 PM


All times are GMT +1. The time now is 09:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"