Hyperlink formulas created shows #value

mdd16

Board Regular
Joined
Jan 11, 2011
Messages
84
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to create a code with which I can create a 'click to dial' hyperlink in a cell in excel which is referring to phone number in another cell.

I used the hyperlink function and want to enter it in the selected cell.

But the result shows #value error and the formula for hyperlink does not get entered in the selected cell.

Please help

Best Regards

Mohan Dhingra

Sub DoTelText()
Dim rng1, rng2 As Range, i As Long
Dim TelText As String

On Error Resume Next

'rng1 = Selection.Address(ReferenceStyle:=xlR1C1)

Set rng1 = Application.InputBox _
("Select the cell with phone number entry", Type:=8)
MsgBox rng1.Address

If rng1 Is Nothing Then
MsgBox "You selected nothing"
Exit Sub
Else
'rng1 = rng1.Address(ReferenceStyle:=xlR1C1)

TelText = "HYPERLINK(CONCAT(""tel:""," & rng1.Address & ")," & rng1.Address & ")"""
MsgBox TelText
Selection.value = "=" & TelText
End If
Selection.Formula = _
Application.ConvertFormula _
(Formula:=Selection.Formula, _
FromReferenceStyle:=xlA1, _
ToReferenceStyle:=xlA1, ToAbsolute:=xlRelative)

'Fm_AddString.Hide

End Sub
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Corrected my own syntax errors..:cool:

Updated code below.. in case someone needs it


Sub DoTelText()
Dim rng1, rng2 As Range, i As Long
Dim TelText As String

On Error Resume Next

'rng1 = Selection.Address(ReferenceStyle:=xlR1C1)

Set rng1 = Application.InputBox _
("Select the cell with phone number entry", Type:=8)

If rng1 Is Nothing Then
MsgBox "You selected nothing"
Exit Sub
Else
'rng1 = rng1.Address(ReferenceStyle:=xlR1C1)

TelText = "IFERROR(HYPERLINK(CONCAT(""tel:""," & rng1.Address & ")," & rng1.Address & "),0)"

Selection.Formula = "=" & TelText
End If
Selection.Formula = _
Application.ConvertFormula _
(Formula:=Selection.Formula, _
FromReferenceStyle:=xlA1, _
ToReferenceStyle:=xlA1, ToAbsolute:=xlRelative)


End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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