Hi there

Would anybody be able to advise me on my problem?

I have 63 command buttons on a userform in multipage controls. Each command button, when clicked, does almost the same thing. For example:

Private Sub cmd2_1_1_Click()
    
    If cmd2_1_1.BackColor = 13485434 Then
    Exit Sub
    End If
    
    cmd2_1_1.BackColor = 13485434
    
    CCaption = cmd2_1_1.Caption: ECaption = "Loft Quilt ": Supplier = "Central Purchasing": GLCode = "5002"
    
    Call ButtonClick
    
End Sub
Private Sub cmd2_1_2_Click()
    
    If cmd2_1_2.BackColor = 13485434 Then
    Exit Sub
    End If
        
    cmd2_1_2.BackColor = 13485434
       
    CCaption = cmd2_1_2.Caption: ECaption = "Loft Quilt ": Supplier = "Central Purchasing": GLCode = "5002"
    
    Call ButtonClick
    
End Sub
and so on. Is there a way to create a sub which will recognise the name of the command button, eg 2_1_1 for cmd 2_1_1 and 2_1_2 for cmd2_1_2 so that I can call that sub to execute the code? There is a different caption name for each button.

Thanks all.