Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Extract URL from Link Cell / Convert imported text links to hyperl

Good day,

This is a continuation to a post from yesterday.

My original question had two parts. Part 2 has been resolved and am pasting
the resolution in case that will be useful to somebody in the community.

I still need assistance resolving Part 1.

================
Part 1 addressed how to extract the hyperlink URL from label cells in Col B
and paste the address values in adjacent cells in Col C.

Sample Data:
B C
Google Blank
Yahoo Blank

Resulting Data Should be
B C
Google http://www.google.com
Yahoo http://www.yahoo.com

With the assistance of Sheeloo, I was able to test the following code.
Dim i
Dim LastRow
LastRow = Range("B431").End(xlUp).Row
For i = 414 To LastRow
Cells(i, 3).Value = Cells(i, 2).Hyperlinks(1).Name
Next i

This code works for the first row of data and extracts the address from the
first cell, but then does not populate the adjacent cells for the rest of the
cells in the range.

Any suggestions as to why this is occurring?


Thanks,


================
Part 2. This issue addressed hyperlinks being pasted in a cell or imported
from a database and appearing as text in a cell rather than as a hyperlink.
The only apparent way to make the cells into hyperlinks was to double click
on each cell and then press ENTER. This would then create a hyperlink from
the text.

In hopes, of benefiting fellow users in the community, the following code
works well for this.

From a list of hyperlinks in text form, this code dynamically selects cells
in Col B from Row 2 to end of the col. The code then makes hyperlinks out of
the text in the cells.

Sub Links()

'Select Cells in Col B from B2 to End of Populated Data
Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).Select

'Create links from the text in the cells
For Each xCell In Selection
ActiveSheet.hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
Next xCell

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Extract URL from Link Cell / Convert imported text links to hyperl

hi,

Maybe this

Sub marine()
Dim myrange As Range
Dim LastRow As Long
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
Set myrange = Range("B1:B" & LastRow)
For Each c In myrange
Hyperlinks.Add c.Offset(, 1), "http://www." & c.Value & ".com/"
Next
End Sub

Mike

"Brent E" wrote:

Good day,

This is a continuation to a post from yesterday.

My original question had two parts. Part 2 has been resolved and am pasting
the resolution in case that will be useful to somebody in the community.

I still need assistance resolving Part 1.

================
Part 1 addressed how to extract the hyperlink URL from label cells in Col B
and paste the address values in adjacent cells in Col C.

Sample Data:
B C
Google Blank
Yahoo Blank

Resulting Data Should be
B C
Google http://www.google.com
Yahoo http://www.yahoo.com

With the assistance of Sheeloo, I was able to test the following code.
Dim i
Dim LastRow
LastRow = Range("B431").End(xlUp).Row
For i = 414 To LastRow
Cells(i, 3).Value = Cells(i, 2).Hyperlinks(1).Name
Next i

This code works for the first row of data and extracts the address from the
first cell, but then does not populate the adjacent cells for the rest of the
cells in the range.

Any suggestions as to why this is occurring?


Thanks,


================
Part 2. This issue addressed hyperlinks being pasted in a cell or imported
from a database and appearing as text in a cell rather than as a hyperlink.
The only apparent way to make the cells into hyperlinks was to double click
on each cell and then press ENTER. This would then create a hyperlink from
the text.

In hopes, of benefiting fellow users in the community, the following code
works well for this.

From a list of hyperlinks in text form, this code dynamically selects cells
in Col B from Row 2 to end of the col. The code then makes hyperlinks out of
the text in the cells.

Sub Links()

'Select Cells in Col B from B2 to End of Populated Data
Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).Select

'Create links from the text in the cells
For Each xCell In Selection
ActiveSheet.hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
Next xCell

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 364
Default Extract URL from Link Cell / Convert imported text links to hyperl

Hello,

Can you tell me what is in B415? I again tested the code and it works fine
for me...

It does fail if I have HYPERLINK formula in a cell...

Add the following line after the "For i = 414 To LastRow" line in your code
given below;
On Error Resume Next

This will help you find out the cells it is failing on and possibly the
reason.

Thanks for sharing your feedback in such a nice way...
"Brent E" wrote:

Good day,

This is a continuation to a post from yesterday.

My original question had two parts. Part 2 has been resolved and am pasting
the resolution in case that will be useful to somebody in the community.

I still need assistance resolving Part 1.

================
Part 1 addressed how to extract the hyperlink URL from label cells in Col B
and paste the address values in adjacent cells in Col C.

Sample Data:
B C
Google Blank
Yahoo Blank

Resulting Data Should be
B C
Google http://www.google.com
Yahoo http://www.yahoo.com

With the assistance of Sheeloo, I was able to test the following code.
Dim i
Dim LastRow
LastRow = Range("B431").End(xlUp).Row
For i = 414 To LastRow
Cells(i, 3).Value = Cells(i, 2).Hyperlinks(1).Name
Next i

This code works for the first row of data and extracts the address from the
first cell, but then does not populate the adjacent cells for the rest of the
cells in the range.

Any suggestions as to why this is occurring?


Thanks,


================
Part 2. This issue addressed hyperlinks being pasted in a cell or imported
from a database and appearing as text in a cell rather than as a hyperlink.
The only apparent way to make the cells into hyperlinks was to double click
on each cell and then press ENTER. This would then create a hyperlink from
the text.

In hopes, of benefiting fellow users in the community, the following code
works well for this.

From a list of hyperlinks in text form, this code dynamically selects cells
in Col B from Row 2 to end of the col. The code then makes hyperlinks out of
the text in the cells.

Sub Links()

'Select Cells in Col B from B2 to End of Populated Data
Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).Select

'Create links from the text in the cells
For Each xCell In Selection
ActiveSheet.hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
Next xCell

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Extract URL from Link Cell / Convert imported text links to hy

Mike,

Thanks for your assistance and the code suggestion. The cells are already
links w/ the URL, but only the cells contain labels to the links. For example
if the label cell says "Google Website", but if u click on it, takes u to
www.google.com.

I am trying to mine the full URL out of the Label in Col B, then paste the
full URL in Col C. So would extract the URL from the "Google Website" cell
and place www.google.com in Col C.

Thanks,

============
Sheeloo,

Thanks for your assistance as well. Yes, you were right, the next cell down
I found was not linked as I thought, only had the formatting of a link so I
dind't catch that, the code works fine now, except it mines out the label
data rather than the URL.

For example in the sample I mentioned above to Mike, if "Google Website"
were in Col B, but embedded in the cell is the link to google. If I run the
code, I am getting "Google Website" placed in Col C rather than the URL.

Any suggestions?

Thanks.

"Mike H" wrote:

hi,

Maybe this

Sub marine()
Dim myrange As Range
Dim LastRow As Long
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
Set myrange = Range("B1:B" & LastRow)
For Each c In myrange
Hyperlinks.Add c.Offset(, 1), "http://www." & c.Value & ".com/"
Next
End Sub

Mike

"Brent E" wrote:

Good day,

This is a continuation to a post from yesterday.

My original question had two parts. Part 2 has been resolved and am pasting
the resolution in case that will be useful to somebody in the community.

I still need assistance resolving Part 1.

================
Part 1 addressed how to extract the hyperlink URL from label cells in Col B
and paste the address values in adjacent cells in Col C.

Sample Data:
B C
Google Blank
Yahoo Blank

Resulting Data Should be
B C
Google http://www.google.com
Yahoo http://www.yahoo.com

With the assistance of Sheeloo, I was able to test the following code.
Dim i
Dim LastRow
LastRow = Range("B431").End(xlUp).Row
For i = 414 To LastRow
Cells(i, 3).Value = Cells(i, 2).Hyperlinks(1).Name
Next i

This code works for the first row of data and extracts the address from the
first cell, but then does not populate the adjacent cells for the rest of the
cells in the range.

Any suggestions as to why this is occurring?


Thanks,


================
Part 2. This issue addressed hyperlinks being pasted in a cell or imported
from a database and appearing as text in a cell rather than as a hyperlink.
The only apparent way to make the cells into hyperlinks was to double click
on each cell and then press ENTER. This would then create a hyperlink from
the text.

In hopes, of benefiting fellow users in the community, the following code
works well for this.

From a list of hyperlinks in text form, this code dynamically selects cells
in Col B from Row 2 to end of the col. The code then makes hyperlinks out of
the text in the cells.

Sub Links()

'Select Cells in Col B from B2 to End of Populated Data
Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).Select

'Create links from the text in the cells
For Each xCell In Selection
ActiveSheet.hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
Next xCell

End Sub

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 to extract numbers from imported cell with text and numbers? jyin Excel Discussion (Misc queries) 3 March 28th 07 01:14 PM
how do I extract hex digits in a cell and convert to binary prs_013 Excel Worksheet Functions 3 March 17th 06 07:14 AM
Batch create hyperl formula from hyperl value Electro911 Excel Discussion (Misc queries) 2 February 27th 06 06:29 PM
convert time imported as text to time format for calculations batfish Excel Worksheet Functions 3 October 27th 05 11:24 PM
How to convert Excel imported numbers from text to numbers? Alden Excel Discussion (Misc queries) 9 April 1st 05 09:51 PM


All times are GMT +1. The time now is 02:09 PM.

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"