I have succesfully colored the font and background of one button (commandbutton_1) in my userform:
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
CommandButton1.BackColor = RGB(220, 230, 241)
CommandButton1.ForeColor = RGB(0, 0, 0)
End Sub
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
CommandButton1.BackColor = RGB(22, 54, 92)
CommandButton1.ForeColor = RGB(255, 255, 255)
End Sub
Private Sub UserForm_Activate()
CommandButton1.BackColor = RGB(22, 54, 92)
CommandButton1.ForeColor = RGB(225, 225, 225)
UserForm.BackColor = RGB(22, 54, 92)
End Sub
But when I apply the same code to my second button (CommandButton2), it is not working properly:
Private Sub CommandButton2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
CommandButton2.BackColor = RGB(220, 230, 241)
CommandButton2.ForeColor = RGB(0, 0, 0)
End Sub
Private Sub UserForm2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
CommandButton2.BackColor = RGB(22, 54, 92)
CommandButton2.ForeColor = RGB(255, 255, 255)
End Sub
Private Sub UserForm2_Activate()
CommandButton2.BackColor = RGB(22, 54, 92)
CommandButton2.ForeColor = RGB(225, 225, 225)
UserForm.BackColor = RGB(22, 54, 92)
End Sub