ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to cause userform to display (https://www.excelbanter.com/excel-programming/283874-how-cause-userform-display.html)

Jim[_31_]

How to cause userform to display
 
Hi all, I know how to make a userform display when a user
selects new from a template, but how do I cause a userform
to display when a certain sequence of keys is
pressed...Ctrl X for example?

Thanks

Chip Pearson[_2_]

How to cause userform to display
 
Jim,

You can use the OnKey to assign a macro to key stroke
combination, and then have that macro show the form. For
example,

Sub SetKey()
Application.OnKey "^X","MacroName"
End Sub
Sub MacroName()
UserForm1.Show
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jim" wrote in message
...
Hi all, I know how to make a userform display when a user
selects new from a template, but how do I cause a userform
to display when a certain sequence of keys is
pressed...Ctrl X for example?

Thanks




losmac[_2_]

How to cause userform to display
 
Insert new module.
Write procedure which shows userform.

Sub ShowMyForm
MyForm.Show
End Sub

Tools - Macro - Macros
Select macro ShowMyForm
Click button Options..
Put there keyboard shortcut...

-----Original Message-----
Hi all, I know how to make a userform display when a user
selects new from a template, but how do I cause a

userform
to display when a certain sequence of keys is
pressed...Ctrl X for example?

Thanks
.


Jim[_31_]

How to cause userform to display
 
Thanks Chip, it works perfectly.

-----Original Message-----
Jim,

You can use the OnKey to assign a macro to key stroke
combination, and then have that macro show the form. For
example,

Sub SetKey()
Application.OnKey "^X","MacroName"
End Sub
Sub MacroName()
UserForm1.Show
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Jim" wrote in

message
...
Hi all, I know how to make a userform display when a

user
selects new from a template, but how do I cause a

userform
to display when a certain sequence of keys is
pressed...Ctrl X for example?

Thanks



.


whisperer[_2_]

How to cause userform to display
 

Jim,

I am not too sure that your understanding of a userform are the same a
mine. The userform that I use is part of the VBE scenario.

Notwithstanding that, if you go to Tools in the Excel menu sheet an
select Macro from the resulting dropdown menu, select 'Record ne
macro..' there is a box that will alow you to add a shortcut key t
activate the macro.

If you already have an existing Macro then instead of 'Record Ne
Macro' select the Macro itself and then Options. The same shortcut ke
facility is available from the reulting dialogue box.

HTH :

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com



All times are GMT +1. The time now is 03:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com