Basically I would like to use a function or sub to "paste" code so that I don't have to paste the same thing over and over again. I'm kinda new with VBA so I'm not sure if there's an easier way to handle this. I have many rows of combo boxes that will be determined by their corresponding text box in front of them. I would like to just place a function/subroutine with a number to designate the combo box.
Function cboAfterUpdate (x as Variant)
Private Sub cboOperation &x& _AfterUpdate()
'some other function that uses x'
End Sub
End Funcion
I'm hoping it'll end like this...
cboAfterUpdate(5)
Will show..
Private Sub cboOperation5_AfterUpdate()
'some other function that uses 5'
End Sub
In other words I'd like to do this
Private Sub cboOperation1_AfterUpdate()
Call SqlDes(1)
End Sub
Private Sub cboOperation2_AfterUpdate()
Call SqlDes(2)
End Sub
Private Sub cboOperation3_AfterUpdate()
Call SqlDes(3)
End Sub
up to 20 times since I have cboOperation(1-20) combo boxes. How can I do that in one function without having to have to copy/paste/type 20 private sub events?