This might well be a no brainer, so sorry about that. I wanted to tidy up my code and instead of repeating it x 3, to have just one set of code with the relevant reference information passed to it.
For example, I have 3 listboxes on a userform with 3 accompanying buttons.
When one of the buttons is clicked it deletes what has been selected in the corresponding listbox as well as checking to see if the entry is in the other 2 listboxes, deleting there too if it is
.
But what that means is I repeat the code that does this for each command button sub relating to each listbox.
What I'd prefer to do (and hopefully someone can help me), is call to a sub procedure the listbox reference I wish to delete the entry in.
How do I do that? I've already tried passing to a sub procedure using:
call listboxdelete(listbox1, listbox2, listbox3)
...and have the procedure start:
Private Sub listboxdelete(sourceLB as listbox, otherLB1 as listbox, otherLB2 as listbox)
But this is giving me a type mismatch error!
For example, I have 3 listboxes on a userform with 3 accompanying buttons.
When one of the buttons is clicked it deletes what has been selected in the corresponding listbox as well as checking to see if the entry is in the other 2 listboxes, deleting there too if it is
.
But what that means is I repeat the code that does this for each command button sub relating to each listbox.
What I'd prefer to do (and hopefully someone can help me), is call to a sub procedure the listbox reference I wish to delete the entry in.
How do I do that? I've already tried passing to a sub procedure using:
call listboxdelete(listbox1, listbox2, listbox3)
...and have the procedure start:
Private Sub listboxdelete(sourceLB as listbox, otherLB1 as listbox, otherLB2 as listbox)
But this is giving me a type mismatch error!