using one sub for multiple buttons in excel vba
<p>I have a spreadsheet containing client data, one client per row and each row has a button that launches a userform showing the data for that client, you can then update the data for that client and write it back to the row for that client.  Before we start using the spreadsheet each case worker will filter so that only their clients are shown.</p>

<p>I wondered whether there is a way of having one command button procedure for the buttons on each row ie when you press the button in row 6 it runs a procedure for CommandButton6 to call the data in that row, when you press the button in row 8 it runs a procedure for CommandButton8 to call the data in row 8. However the procedure for both is the same so can I have a CommandButtoni sub where I is the row number.</p>

<p>It is a very simple procedure but I don't want to have to copy it 350 times!</p>

<pre><code>Private Sub CommandButton1_Click()

UserForm1.TextBox1.Value = Worksheets("Sheet1").Range("C2").Value
GetData

UserForm1.Show

End Sub
</code></pre>