Shortcut key and UserForm

C

Cerberus

I want to use a shortcut key (Ctrl+z) to activate a UserForm but don't know
for sure it is possible or how to go about it. I've always used a Command
Button or a _Click() in the past. Any ideas on how to go about this? Thanks
in advance.
 
R

Ryan H

I wouldn't recommend using Ctrl + z, because that is the undo method for
Office. Your users may not like that.
 
P

Peter T

As Ryan Says, probably best not to use Ctrl Z.

Try the following in the open/close events to add/remove a shortcut for
Shift-Ctrl-Z, to call your macro that shows the form

Sub auto_Open()
Application.OnKey "+^Z", ThisWorkbook.Name & "!ShowFrmMyStuff"
End Sub

Sub Auto_Close()
Application.OnKey "+^Z"
End Sub

Sub ShowFrmMyStuff()
UserForm1.Show
End Sub

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top