![]() |
List Box
I have a macro that looks for the value in a list box and then runs a set of
macros. I have the code to exit the Sub and display a message box if there isn't a value selected from the list box. If frmRefresh.ListBox3.Value = "" Then Exit Sub MsgBox "Select A Value from the List Box, vbOKOnly, "Error" Else Application.Run............................... End If It simply debugs later on because nothing is selected in the Listbox. I need the wording for the If statement to stop the macro if nothing is selected in the listbox. Thanks in advance |
List Box
Try...
If Trim(frmRefresh.ListBox3.Value) = "" Then MsgBox "Select A Value from the List Box", vbOKOnly, "Error" Exit Sub Else Application.Run............................... End If -- If this post helps click Yes --------------- Jacob Skaria "N1KO" wrote: I have a macro that looks for the value in a list box and then runs a set of macros. I have the code to exit the Sub and display a message box if there isn't a value selected from the list box. If frmRefresh.ListBox3.Value = "" Then Exit Sub MsgBox "Select A Value from the List Box, vbOKOnly, "Error" Else Application.Run............................... End If It simply debugs later on because nothing is selected in the Listbox. I need the wording for the If statement to stop the macro if nothing is selected in the listbox. Thanks in advance |
List Box
Hi Jacob,
Unfortunately it doesn't work, it brings up and error box with an invalid use of null. Thank you very much though. "Jacob Skaria" wrote: Try... If Trim(frmRefresh.ListBox3.Value) = "" Then MsgBox "Select A Value from the List Box", vbOKOnly, "Error" Exit Sub Else Application.Run............................... End If -- If this post helps click Yes --------------- Jacob Skaria "N1KO" wrote: I have a macro that looks for the value in a list box and then runs a set of macros. I have the code to exit the Sub and display a message box if there isn't a value selected from the list box. If frmRefresh.ListBox3.Value = "" Then Exit Sub MsgBox "Select A Value from the List Box, vbOKOnly, "Error" Else Application.Run............................... End If It simply debugs later on because nothing is selected in the Listbox. I need the wording for the If statement to stop the macro if nothing is selected in the listbox. Thanks in advance |
List Box
strValue = frmRefresh.ListBox3.Text
If Trim(strValue) = "" Then MsgBox "Select A Value from the List Box", vbOKOnly, "Error" Exit Sub Else 'Application.Run............................... End If If this post helps click Yes --------------- Jacob Skaria "N1KO" wrote: Hi Jacob, Unfortunately it doesn't work, it brings up and error box with an invalid use of null. Thank you very much though. "Jacob Skaria" wrote: Try... If Trim(frmRefresh.ListBox3.Value) = "" Then MsgBox "Select A Value from the List Box", vbOKOnly, "Error" Exit Sub Else Application.Run............................... End If -- If this post helps click Yes --------------- Jacob Skaria "N1KO" wrote: I have a macro that looks for the value in a list box and then runs a set of macros. I have the code to exit the Sub and display a message box if there isn't a value selected from the list box. If frmRefresh.ListBox3.Value = "" Then Exit Sub MsgBox "Select A Value from the List Box, vbOKOnly, "Error" Else Application.Run............................... End If It simply debugs later on because nothing is selected in the Listbox. I need the wording for the If statement to stop the macro if nothing is selected in the listbox. Thanks in advance |
All times are GMT +1. The time now is 06:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com