C
CJ
Scenario:
IF a cell in column D, contains *any* number within *any* text, then
convert *each* number to a hyperlink.
In my spreadsheet I have:
Cell D6 = 821-incorrect fonts
Cell D7 = blank
Cell D8 = 821-incorrect fonts, 834-misaligned page
What I want to have here is a macro to convert the above cell contents
to this:
Cell D6 = =HYPERLINK("http://qabugzilla.lagarde.com/show_bug.cgi?
id=821","821-incorrect fonts")
Cell D7 = blank
Cell D8 = =HYPERLINK("http://qabugzilla.lagarde.com/show_bug.cgi?
id=821","821-incorrect fonts") & HYPERLINK("http://
qabugzilla.lagarde.com/show_bug.cgi?id=834","834-misaligned page")
Below is what I've got started, it obviously doesn't complete what I'm
looking for.
What I know that I'm missing in my macro is:
1. I am using cell.value instead of finding the number within the
cell.value to add to the hyperlinkaddress.
2. I don't know how to create two separate hyperlinks within a single
cell. (I'm not sure this is possible.)
Can anyone offer some help with this? Thanks a million in advance!
Sub MakeBugHyperlinks()
Dim cell As Range
Dim path As String
Dim bugNo As String
Dim HyperlinkAddress As String
path = "http://qabugzilla.domain.com/show_bug.cgi?id="
For Each cell In Intersect(Selection, ActiveSheet.UsedRange)
bugNo = cell.Value
HyperlinkAddress = path & bugNo
cell.Formula = "=HYPERLINK(""" & HyperlinkAddress & _
""",""" & bugNo & """)"
Next cell
End Sub
IF a cell in column D, contains *any* number within *any* text, then
convert *each* number to a hyperlink.
In my spreadsheet I have:
Cell D6 = 821-incorrect fonts
Cell D7 = blank
Cell D8 = 821-incorrect fonts, 834-misaligned page
What I want to have here is a macro to convert the above cell contents
to this:
Cell D6 = =HYPERLINK("http://qabugzilla.lagarde.com/show_bug.cgi?
id=821","821-incorrect fonts")
Cell D7 = blank
Cell D8 = =HYPERLINK("http://qabugzilla.lagarde.com/show_bug.cgi?
id=821","821-incorrect fonts") & HYPERLINK("http://
qabugzilla.lagarde.com/show_bug.cgi?id=834","834-misaligned page")
Below is what I've got started, it obviously doesn't complete what I'm
looking for.
What I know that I'm missing in my macro is:
1. I am using cell.value instead of finding the number within the
cell.value to add to the hyperlinkaddress.
2. I don't know how to create two separate hyperlinks within a single
cell. (I'm not sure this is possible.)
Can anyone offer some help with this? Thanks a million in advance!
Sub MakeBugHyperlinks()
Dim cell As Range
Dim path As String
Dim bugNo As String
Dim HyperlinkAddress As String
path = "http://qabugzilla.domain.com/show_bug.cgi?id="
For Each cell In Intersect(Selection, ActiveSheet.UsedRange)
bugNo = cell.Value
HyperlinkAddress = path & bugNo
cell.Formula = "=HYPERLINK(""" & HyperlinkAddress & _
""",""" & bugNo & """)"
Next cell
End Sub