Fechando o userform ao teclar ESC

Insira este código dentro o Userform e ao teclar ESC o formulário será fechado.

 

Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 27 Then
Unload Me
End If

End Sub

 

Voltar