Copying a cell's contents into a string

mj0lnr

New Member
Joined
May 6, 2003
Messages
46
Hello,

I'm sure this has been asked before, but I couldn't locate it. I have a range of cells that I'd like to have checked for data (it's always going to numbers) and if it's populated with a number, it copies those contents into a hyperlink text string. The hyperlink always stays the same, only the contents of the cell will have an effect on it. The only thing I'm really asking for is help with the if, next statements.

Sincerely any appreciate help in advance -
A.
:bow:
 
Parry, it works great, but another request :wink: you hit it with the other post you put up there. The cell with the actual data I would like to be the actual link, not an empty one. Sawry :-(

A.
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
enjoy :lol:

Code:
Sub HyperLinkColH()
Dim MyAddress As String, NBR As Long, c

'Find next blank row in column H. Start at row 23 if its blank.
If IsEmpty(Range("h23")) Then
NBR = 23
Else
NBR = Range("h65536").End(xlUp).Row + 1
End If

'Look thru selection and place hyperlink in Col H if the
'cell is a number
For Each c In Selection
If IsNumeric(c) Then
MyAddress = "http://IM/Peregrine/WhatsMyStatus/default.asp?ProbID=IM" _
& c & "&submit1=Get+Ticket+Information&SearchName="

Cells(NBR, 8).Hyperlinks.Add Anchor:=Cells(NBR, 8), _
Address:=MyAddress, TextToDisplay:=Str(c.Value)
NBR = NBR + 1
End If

Next c

End Sub
 
Upvote 0
Parry, I cannot thank you enough.....works like a champ.....I don't supposed I can ask you for another favor? I have two sets of code that I need to combine into one very smooth macro, if I post both sets of code up here could you help me tidy it up and see if they can fit together?

A.
 
Upvote 0

Forum statistics

Threads
1,222,908
Messages
6,168,967
Members
452,228
Latest member
just4jeffrey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top