ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hyperlinks (https://www.excelbanter.com/excel-programming/375142-hyperlinks.html)

DavidM

Hyperlinks
 
Hi

I have a column of many web page hyperlinks is it possible to edit a
hyperlink with a macro to delete certain characters, like the 8 to 12th
characters. Instead of right clicking edit hyperlink, Then move to the next,
I then check this hyperlink if it needs to be changed I then run the macro
again.

Thanks in advance

Dave




Don Guillett

Hyperlinks
 
one way
Sub edithyperlinks()
For Each c In Range("i1:i3")
c.Value = Left(c, 7) & "XXXX" & Right(c, Len(c) - 11)
Next
End Sub


--
Don Guillett
SalesAid Software

"DavidM" wrote in message
. uk...
Hi

I have a column of many web page hyperlinks is it possible to edit a
hyperlink with a macro to delete certain characters, like the 8 to 12th
characters. Instead of right clicking edit hyperlink, Then move to the
next, I then check this hyperlink if it needs to be changed I then run the
macro again.

Thanks in advance

Dave






Tom Ogilvy

Hyperlinks
 
Sub CheckLinks()
Dim s as String, ans as Long
if Activecell.Hyperlinks.count 0 then
s = Activecell.Hyperlinks(1).Address
ans = msgbox("hyperlink is " & vbNewLine & s & vbNewline _
& vbNewline & " Make a correction?", vbYesNo)
if ans = vbYes then
s = Left(s,7) & Right(s,len(s)-12)
ActiveCell.Hyperlinks(1).Address = s
end if
end if
activecell.offset(1,0).Select
End Sub

--
Regards,
Tom Ogilvy


"DavidM" wrote in message
. uk...
Hi

I have a column of many web page hyperlinks is it possible to edit a
hyperlink with a macro to delete certain characters, like the 8 to 12th
characters. Instead of right clicking edit hyperlink, Then move to the
next, I then check this hyperlink if it needs to be changed I then run the
macro again.

Thanks in advance

Dave






DavidM

Hyperlinks
 
Thanks Don

Thanks Tom


"Tom Ogilvy" wrote in message
...
Sub CheckLinks()
Dim s as String, ans as Long
if Activecell.Hyperlinks.count 0 then
s = Activecell.Hyperlinks(1).Address
ans = msgbox("hyperlink is " & vbNewLine & s & vbNewline _
& vbNewline & " Make a correction?", vbYesNo)
if ans = vbYes then
s = Left(s,7) & Right(s,len(s)-12)
ActiveCell.Hyperlinks(1).Address = s
end if
end if
activecell.offset(1,0).Select
End Sub

--
Regards,
Tom Ogilvy


"DavidM" wrote in message
. uk...
Hi

I have a column of many web page hyperlinks is it possible to edit a
hyperlink with a macro to delete certain characters, like the 8 to 12th
characters. Instead of right clicking edit hyperlink, Then move to the
next, I then check this hyperlink if it needs to be changed I then run
the macro again.

Thanks in advance

Dave








Don Guillett

Hyperlinks
 
glad to help

--
Don Guillett
SalesAid Software

"DavidM" wrote in message
. uk...
Thanks Don

Thanks Tom


"Tom Ogilvy" wrote in message
...
Sub CheckLinks()
Dim s as String, ans as Long
if Activecell.Hyperlinks.count 0 then
s = Activecell.Hyperlinks(1).Address
ans = msgbox("hyperlink is " & vbNewLine & s & vbNewline _
& vbNewline & " Make a correction?", vbYesNo)
if ans = vbYes then
s = Left(s,7) & Right(s,len(s)-12)
ActiveCell.Hyperlinks(1).Address = s
end if
end if
activecell.offset(1,0).Select
End Sub

--
Regards,
Tom Ogilvy


"DavidM" wrote in message
. uk...
Hi

I have a column of many web page hyperlinks is it possible to edit a
hyperlink with a macro to delete certain characters, like the 8 to 12th
characters. Instead of right clicking edit hyperlink, Then move to the
next, I then check this hyperlink if it needs to be changed I then run
the macro again.

Thanks in advance

Dave











All times are GMT +1. The time now is 03:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com