Write a function that accepts an argument indicating which button called it,
and use a Select Case construct in the function to do the processing.
For example the function could be like this
Function DoProcessing (strCmdButton As String)
Select Case strCmdButton
Case "Button1"
Debug.Print "Processing for button 1."
Case "Button2"
Debug.Print "Processing for button 2."
...
Case Else
Debug.Print "Oops. Forgot to handle " & strCmdButton
End Select
End Sub
And you call it by setting the On Click of Button2 to:
=DoProcessing("Button2")
If you don't want to pass the button name, and you are absolutely certain
the code will not be called by any other means that clicking the button, you
could drop the argument and use:
Select Case Form.ActiveControl.Name