View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default How can I reuse function for a userform button

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)

"axwack" wrote in message
ups.com...
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.