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 Check for Hyperlink

I have a column of data that has a hyperlink on some rows, but not all. I
need to loop through say column B and if the cell has a Hyperlink then
change it to a new one. In this column the basic change would be the URL IP
& CMTS IP.
Old
http://12.220.6.163/cgi-bin/Service_...E=laf livfile

New
http://12.220.9.41/cgi-bin/Service_V...E=laf livfile

As you can see they have changed the site IP and the CMTS IP. Everything
else remained the same. These two items would need changed for every cell in
column B that has a hyperlink. However, each row in column B will have a
different NODE name. For example the next cell that has a hyperlink would
have:
http://12.220.6.163/cgi-bin/Service_...E=laf livfile

Notice the Node name in the middle of the link is different.

NODE_STATUS_REQUEST&NODE=E-03
This needs NOT to be changed for that cell.

How would I test for a hyperlink and if it has one, change only the 2 IPs?
I am thinking a helper sheet would be handy for future changes where I enter
the new IPs in A1 & A2 and use those values in the code. Any suggestions or
code would be appreciated to get me started.

Mike F


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Check for Hyperlink

The hyperlinks that were inserted via Insert|Hyperlink?

Option Explicit
Sub FixHyperlinks()
Dim OldStr As String
Dim NewStr As String
OldStr = "12.220.5.233"
NewStr = "12.220.5.241"
Dim hyp As Hyperlink
For Each hyp In ActiveSheet.Range("b:b").Hyperlinks
hyp.Address = Replace(hyp.Address, OldStr, NewStr)
Next hyp
End Sub

This code was is a modified version of David McRitchie's:
http://www.mvps.org/dmcritchie/excel/buildtoc.htm
look for:
Fix Hyperlinks (#FixHyperlinks)



Mike Fogleman wrote:

I have a column of data that has a hyperlink on some rows, but not all. I
need to loop through say column B and if the cell has a Hyperlink then
change it to a new one. In this column the basic change would be the URL IP
& CMTS IP.
Old
http://12.220.6.163/cgi-bin/Service_...E=laf livfile

New
http://12.220.9.41/cgi-bin/Service_V...E=laf livfile

As you can see they have changed the site IP and the CMTS IP. Everything
else remained the same. These two items would need changed for every cell in
column B that has a hyperlink. However, each row in column B will have a
different NODE name. For example the next cell that has a hyperlink would
have:
http://12.220.6.163/cgi-bin/Service_...E=laf livfile

Notice the Node name in the middle of the link is different.

NODE_STATUS_REQUEST&NODE=E-03
This needs NOT to be changed for that cell.

How would I test for a hyperlink and if it has one, change only the 2 IPs?
I am thinking a helper sheet would be handy for future changes where I enter
the new IPs in A1 & A2 and use those values in the code. Any suggestions or
code would be appreciated to get me started.

Mike F


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Check for Hyperlink

Thanks Dave. I used this format and modified it for several different
columns and also created hyperlinks where they were missing.

Mike F
"Dave Peterson" wrote in message
...
The hyperlinks that were inserted via Insert|Hyperlink?

Option Explicit
Sub FixHyperlinks()
Dim OldStr As String
Dim NewStr As String
OldStr = "12.220.5.233"
NewStr = "12.220.5.241"
Dim hyp As Hyperlink
For Each hyp In ActiveSheet.Range("b:b").Hyperlinks
hyp.Address = Replace(hyp.Address, OldStr, NewStr)
Next hyp
End Sub

This code was is a modified version of David McRitchie's:
http://www.mvps.org/dmcritchie/excel/buildtoc.htm
look for:
Fix Hyperlinks (#FixHyperlinks)



Mike Fogleman wrote:

I have a column of data that has a hyperlink on some rows, but not all. I
need to loop through say column B and if the cell has a Hyperlink then
change it to a new one. In this column the basic change would be the URL
IP
& CMTS IP.
Old
http://12.220.6.163/cgi-bin/Service_...E=laf livfile

New
http://12.220.9.41/cgi-bin/Service_V...E=laf livfile

As you can see they have changed the site IP and the CMTS IP. Everything
else remained the same. These two items would need changed for every cell
in
column B that has a hyperlink. However, each row in column B will have a
different NODE name. For example the next cell that has a hyperlink would
have:
http://12.220.6.163/cgi-bin/Service_...E=laf livfile

Notice the Node name in the middle of the link is different.

NODE_STATUS_REQUEST&NODE=E-03
This needs NOT to be changed for that cell.

How would I test for a hyperlink and if it has one, change only the 2
IPs?
I am thinking a helper sheet would be handy for future changes where I
enter
the new IPs in A1 & A2 and use those values in the code. Any suggestions
or
code would be appreciated to get me started.

Mike F


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Check for Hyperlink

When I have lots of hyperlinks on a worksheet, I'll use:
=hyperlink()

I find them to be better behaved.

Mike Fogleman wrote:

Thanks Dave. I used this format and modified it for several different
columns and also created hyperlinks where they were missing.

Mike F
"Dave Peterson" wrote in message
...
The hyperlinks that were inserted via Insert|Hyperlink?

Option Explicit
Sub FixHyperlinks()
Dim OldStr As String
Dim NewStr As String
OldStr = "12.220.5.233"
NewStr = "12.220.5.241"
Dim hyp As Hyperlink
For Each hyp In ActiveSheet.Range("b:b").Hyperlinks
hyp.Address = Replace(hyp.Address, OldStr, NewStr)
Next hyp
End Sub

This code was is a modified version of David McRitchie's:
http://www.mvps.org/dmcritchie/excel/buildtoc.htm
look for:
Fix Hyperlinks (#FixHyperlinks)



Mike Fogleman wrote:

I have a column of data that has a hyperlink on some rows, but not all. I
need to loop through say column B and if the cell has a Hyperlink then
change it to a new one. In this column the basic change would be the URL
IP
& CMTS IP.
Old
http://12.220.6.163/cgi-bin/Service_...E=laf livfile

New
http://12.220.9.41/cgi-bin/Service_V...E=laf livfile

As you can see they have changed the site IP and the CMTS IP. Everything
else remained the same. These two items would need changed for every cell
in
column B that has a hyperlink. However, each row in column B will have a
different NODE name. For example the next cell that has a hyperlink would
have:
http://12.220.6.163/cgi-bin/Service_...E=laf livfile

Notice the Node name in the middle of the link is different.

NODE_STATUS_REQUEST&NODE=E-03
This needs NOT to be changed for that cell.

How would I test for a hyperlink and if it has one, change only the 2
IPs?
I am thinking a helper sheet would be handy for future changes where I
enter
the new IPs in A1 & A2 and use those values in the code. Any suggestions
or
code would be appreciated to get me started.

Mike F


--

Dave Peterson


--

Dave Peterson
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
make a check form, and then have info go to a check register richie g Excel Worksheet Functions 0 May 5th 10 12:10 AM
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
Increase size of a Forms Check Box (click on to enter check mark) 718Satoshi Excel Discussion (Misc queries) 0 August 17th 07 01:52 AM
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM


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