ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Execute Code (https://www.excelbanter.com/excel-programming/354834-execute-code.html)

gti_jobert[_48_]

Execute Code
 

Hi all,

I want to execute all the code in a cmdButton on a userform when a
keypress is registerd.


Code:
--------------------

Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 10Then
'goto cmdSearch (execute the cmdSearch Code)
End If
End Sub

--------------------


Any ideas? Thanks!


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=518152


Ardus Petus

Execute Code
 
See amanded code

HTH
--
AP

"gti_jobert" a
écrit dans le message de
...

Hi all,

I want to execute all the code in a cmdButton on a userform when a
keypress is registerd.


Code:
--------------------

Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 10Then

cmdSearch
End If
End Sub

--------------------


Any ideas? Thanks!


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile:

http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=518152




tony h[_79_]

Execute Code
 

move the code inside the command button routine into a general modul
(create the module using insert...module and call it as a public sub

eg
public sub doCMD

end sub


then change the cmdbutton code to call doCMD and the keypress i
ascii=10 to call docmd

Hope this helps
regards,

gti_jobert Wrote:
Hi all,

I want to execute all the code in a cmdButton on a userform when
keypress is registerd.


Code
-------------------

Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 10Then
'goto cmdSearch (execute the cmdSearch Code)
End If
End Sub

-------------------


Any ideas? Thanks


--
tony
-----------------------------------------------------------------------
tony h's Profile: http://www.excelforum.com/member.php...fo&userid=2107
View this thread: http://www.excelforum.com/showthread.php?threadid=51815



All times are GMT +1. The time now is 09:09 PM.

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