VBA Msgbox with clickable URL

MeaclH

Board Regular
Joined
Apr 2, 2014
Messages
94
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,
Have a wonderful code working as intended from you helpful folk.
I am wondering if it is possible to have a clickable URL appear in the MsgBox? The results in the MsgBox are searched for in a table with the relevant data formatted as hyperlinks, but when I have tried it just comes up as plain text.

Any ideas? Below is the code.

Thanks heaps for any help you may have.
Hayden
VBA Code:
Sub Worksheet_Change(ByVal Target As Range)
Dim lookupval As String
Dim result As Range
Application.EnableEvents = False
On Error GoTo ExitNow
If Not Intersect(Target, Range("B14")) Is Nothing Then
    If Len(Target) = 3 Then
        lookupval = Target
        Set result = Range("M2:M233").Find(lookupval)
        If Not result Is Nothing Then
            MsgBox " " & vbCrLf & _
            "Location Name: " & Range("N" & result.Row) & vbCrLf & _
            "3 Letter Code: " & Range("M" & result.Row) & vbCrLf & _
            "Lines: " & Range("O" & result.Row) & vbCrLf & _
            "Terminating Location: " & Range("P" & result.Row) & vbCrLf & _
            "Stabling Location: " & Range("Q" & result.Row) & vbCrLf & _
            "Number of Stabling Roads: " & Range("T" & result.Row) & vbCrLf & _
            "Meal Break Location: " & Range("R" & result.Row) & vbCrLf & _
            "Drivers Depot: " & Range("S" & result.Row) & vbCrLf & _
            "Google Map Taxi Pickup: " & Range("U" & result.Row), Title:="Location Info"
        Else
            MsgBox "Location not found. Please check your spelling and try again.", vbCritical, Title:="Location Not Found"
        End If
    Else
        lookupval = Target
        Set result = Range("N2:N233").Find(lookupval)
        If Not result Is Nothing Then
            MsgBox " " & vbCrLf & _
            "Location Name: " & Range("N" & result.Row) & vbCrLf & _
            "3 Letter Code: " & Range("M" & result.Row) & vbCrLf & _
            "Lines: " & Range("O" & result.Row) & vbCrLf & _
            "Terminating Location: " & Range("P" & result.Row) & vbCrLf & _
            "Stabling Location: " & Range("Q" & result.Row) & vbCrLf & _
            "Number of Stabling Roads: " & Range("T" & result.Row) & vbCrLf & _
            "Meal Break Location: " & Range("R" & result.Row) & vbCrLf & _
            "Drivers Depot: " & Range("S" & result.Row) & vbCrLf & _
            "Google Map Taxi Pickup: " & Range("U" & result.Row), Title:="Location Info"
        Else
            MsgBox "Location not found. Please check your spelling and try again.", vbCritical, Title:="Location Not Found"
        End If
    End If
End If
ExitNow:
Application.EnableEvents = True
End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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