Exit Sub if field is blank?

McLaren

Board Regular
Joined
Jul 12, 2003
Messages
122
Anyone know why this isn't working?
Code:
Private Sub Program___Click()
If Program__ = "" Then
Exit Sub
ElseIf Program__ = "CALC" Then
LinkName = "\\fileserv\manufacturing\Fadal\Brad\Programs\Calculators.vbs"
Else
LinkName = "\\fileserv\manufacturing\Fadal\" & Program__ & ".tap"
End If
Application.FollowHyperlink LinkName, , True, False
End Sub


What I am hoping for is if the Column "Program#" contains the word "CALC" to open the .vbs script(works fine), if it contains anything else to open the relevant .tap file(works fine), and if it's empty to do nothing(errors out trying to open 'nothing' I guess).
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Got it.
Code:
Private Sub Command3_Click()
On Error Resume Next
If Program__ = "CALC" Then
LinkName = "\\fileserv\manufacturing\Fadal\Brad\Programs\Calculators.vbs"
Else
LinkName = "\\fileserv\manufacturing\Fadal\" & Program__ & ".tap"
End If
Application.FollowHyperlink LinkName, , True, False
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,889
Messages
6,162,624
Members
451,778
Latest member
ragananthony7911

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