B
Brent E
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
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