how do i delete just 1 hyperlink in a column of many?
Hi,
it seems that 'HyperLink' belongs to a sheet, not a cell.
pasting to cell-range makes one new hyperlink for the range that is
its anchor, not for each cell.
i suppose that you should add the hyperlink again with new anchor-range,
or have made one hyperlink have one anchor-cell at first.
anchor-range can be known from Range property of HyperLink object.
Sub Test()
Dim h, r, r2
On Error Resume Next
For Each h In ActiveSheet.Hyperlinks
Set r = Nothing
Set r = h.Range
Err.Clear
If Not r Is Nothing Then
For Each r2 In r
Debug.Print r2.Address(0, 0) & ": ", _
r2.Hyperlinks(1).Range.Address(0, 0)
Next
End If
Next
End Sub
--
HTH,
okaizawa
Elizabeth wrote:
Tom:
Thank you for your suggestion. I tried it, but get the same result as my
code (it initially works, but on subsequent tries it deletes all hyperlinks
except the last one in the column). But thanks again for giving it a shot.
Elizabeth
"Tom Ogilvy" wrote:
Try
Sub Hyperlink_Remove()
Workbooks("Fiduciaries.xls").Worksheets("Sheet4" ).Range("G1").Hyperlinks(1).
Delete
End Sub
--
Regards,
Tom Ogilvy
"Elizabeth" wrote in message
...
i am trying to write a macro to delete the hyperlink in G1; i want all
other
hyperlinks in column G to remain functional. [i daily copy & paste info
into
this column but don't want the title's hyperlink to be used.] when i use
the
following code, it works the first time. but while testing (i'm new at
vba),
when i copy a hyperlink from G2 or G10 etc., up to G1 & run my macro
again,
it usually removes the hyperlink from all except the last one in the
column
(i.e., it removes G1:G9 hyperlinks & leaves G10's). why is this
happening?
Sub Hyperlink_Remove()
Workbooks("Fiduciaries.xls").Worksheets("Sheet4" ).Range("G1").Hyperlinks.Del
ete
End Sub
thank you for any suggestions.
elizabeth
|