title: Multiple Command Buttons
body: <p>I am making a sheet to help with Sudoku and have command buttons from 1 t0 9 that change from the number to blank when pressed.
  Code for each button is:-</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  If CommandButton1.Caption = "1" Then CommandButton1.Caption = "" Else CommandButton1.Caption = "1"
  End Sub
  
  Private Sub CommandButton2_Click()
  If CommandButton2.Caption = "2" Then CommandButton2.Caption = "" Else CommandButton2.Caption = "2"
  End Sub
  
  Private Sub CommandButton3_Click()
  If CommandButton3.Caption = "3" Then CommandButton3.Caption = "" Else CommandButton3.Caption = "3"
  End Sub
  
  Private Sub CommandButton4_Click()
  If CommandButton4.Caption = "4" Then CommandButton4.Caption = "" Else CommandButton4.Caption = "4"
  End Sub
  
  Private Sub CommandButton5_Click()
  If CommandButton5.Caption = "5" Then CommandButton5.Caption = "" Else CommandButton5.Caption = "5"
  End Sub
  
  Private Sub CommandButton6_Click()
  If CommandButton6.Caption = "6" Then CommandButton6.Caption = "" Else CommandButton6.Caption = "6"
  End Sub
  
  Private Sub CommandButton7_Click()
  If CommandButton7.Caption = "7" Then CommandButton7.Caption = "" Else CommandButton7.Caption = "7"
  End Sub
  
  Private Sub CommandButton8_Click()
  If CommandButton8.Caption = "8" Then CommandButton8.Caption = "" Else CommandButton8.Caption = "8"
  End Sub
  
  Private Sub CommandButton9_Click()
  If CommandButton9.Caption = "9" Then CommandButton9.Caption = "" Else CommandButton9.Caption = "9"
  End Sub
  </code></pre>
  
  <p>I want to copy and past these nine buttons and have the code retained in the command button but have the button number change in the code but keep the rest of the code the same. Is that possible.</p>
  
  <pre><code>Private Sub CommandButton10_Click()
  If CommandButton1.Caption = "1" Then CommandButton1.Caption = "" Else CommandButton1.Caption = "1"
  End Sub
  </code></pre>