Good morning, does anyone know a workaround for the below?
Context: I have made a user form with a list box to allow the user to select which processes they need to run. The names of the processes are what the user calls them, not necessarily the sub procedure name itself. That information is currently placed within a spreadsheet that can then be retrieved when looping through the listbox with all of the processes on it. I have looked at the syntax rules of the Call statement, and it's looking like I can't use a variable.
The Dilemma: I have several user processes. To use a select case statement and manually type out each sub procedure's name can be tedious. Not to mention, We will likely be adding more procedures and possibly getting rid of some as time goes on. So to do a select case statement doesn't seem optimal to me for maintenance purposes, not to mention it has the potential of becoming way to long for my liking.
What I am trying to do: My idea was to pass the sub procedure name to a variable and then call the sub procedure using the string value stored in that variable. I have attached snippets of the code, populated listbox, and worksheet. But basically, the code looks like this.
Code:
If ListboxItem.selected (i) Then
Do Until find ListboxItem value
Loop
ProcedureName = .cells(row,"B").value
Call ProcedureName
End if
Bookmarks