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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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