How can I reuse function for a userform button

  • Thread starter Thread starter axwack
  • Start date Start date
A

axwack

I have move up and move down buttons that move data lists up and down
on a list box.

The buttons are repeated on different tabs of the same form.

I want to pass a reference of the button ("Move Up") to my move up
code. How can I send a generic reference of a control to a function?

Is it

private sub function (Button as Control)

do code

end Sub

Any help is appreciated.
 
Private Sub cmdOK_Click()
Call myFunc(Me.cmdOK)
Me.Hide
End Sub

Private Function myFunc(btn As MSForms.CommandButton)
MsgBox btn.Name
End Function


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top