Reputation: 1
Can someone please help me to modify the below to include the selected cell range from sheets. say sheet2 cell range IS B1:B200. kindly Help.
Sub ConvertToHyperlinks()
' Updated By Nirmla`
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Converrt Hyper Link"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
Application.ActiveSheet.Hyperlinks.Add Rng, Rng.value
Next
End Sub
I dont know anything on VBA. Kindly help.
Upvotes: 0
Views: 130
Reputation: 6271
Sub ConvertToHyperlinks()
'Updated By Nirmla`
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Converrt Hyper Link"
'Set WorkRng = Application.Selection
'Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = Range("Sheet2!B1:B200")
For Each Rng In WorkRng
Application.ActiveSheet.Hyperlinks.Add Rng, Rng.Value
Next
End Sub
Or type it in the InputBox. Then no need to edit the code. Type Sheet2!B1:B200
Upvotes: 1