Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code help - onkey

I have put the following code in the module of my main userform;

Sub OnKey
Application.Onkey, "{Tab}", "Update"
End Sub

Sub Update()
TextBox586.Value = Worksheets("IncStmtSummary").Range("F5")
TextBox586.Text = Format(TextBox586.Text, "$#,##0")
End Sub

I am attempting to have TextBox586 update whenever the Tab key i
pressed. It does not work. Any suggestions. Does it matter where
put the code??

Thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default code help - onkey

Hi

This will work
Don't use Onkey for a macro name because Excel think it is code
In your other code you have a typo ( , after Application.OnKey )

Sub OnKeySub2()
Application.OnKey "{Tab}", "Update"
End Sub

Sub Update()
MsgBox ""
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"bforster1 " wrote in message ...
I have put the following code in the module of my main userform;

Sub OnKey
Application.Onkey, "{Tab}", "Update"
End Sub

Sub Update()
TextBox586.Value = Worksheets("IncStmtSummary").Range("F5")
TextBox586.Text = Format(TextBox586.Text, "$#,##0")
End Sub

I am attempting to have TextBox586 update whenever the Tab key is
pressed. It does not work. Any suggestions. Does it matter where I
put the code??

Thanks.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default code help - onkey

try this:

Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = vbKeyTab Then
Call Update
End If
End Sub

This code must go in the codebehind the form; Update must be a Public
routine to work.

HTH

Tim

"bforster1 " wrote in message
...
I have put the following code in the module of my main userform;

Sub OnKey
Application.Onkey, "{Tab}", "Update"
End Sub

Sub Update()
TextBox586.Value = Worksheets("IncStmtSummary").Range("F5")
TextBox586.Text = Format(TextBox586.Text, "$#,##0")
End Sub

I am attempting to have TextBox586 update whenever the Tab key is
pressed. It does not work. Any suggestions. Does it matter where I
put the code??

Thanks.


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default code help - onkey

Oops

You say userform
See Tim his reply

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Hi

This will work
Don't use Onkey for a macro name because Excel think it is code
In your other code you have a typo ( , after Application.OnKey )

Sub OnKeySub2()
Application.OnKey "{Tab}", "Update"
End Sub

Sub Update()
MsgBox ""
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"bforster1 " wrote in message ...
I have put the following code in the module of my main userform;

Sub OnKey
Application.Onkey, "{Tab}", "Update"
End Sub

Sub Update()
TextBox586.Value = Worksheets("IncStmtSummary").Range("F5")
TextBox586.Text = Format(TextBox586.Text, "$#,##0")
End Sub

I am attempting to have TextBox586 update whenever the Tab key is
pressed. It does not work. Any suggestions. Does it matter where I
put the code??

Thanks.


---
Message posted from http://www.ExcelForum.com/





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
onkey help wardy Excel Programming 0 July 20th 04 05:49 PM
onkey peter Excel Programming 2 March 2nd 04 07:34 PM
Onkey Method Fred Lambelet Excel Programming 3 January 23rd 04 05:20 AM
Onkey Error SuperJas Excel Programming 1 January 12th 04 02:57 AM
Onkey Jase Excel Programming 1 November 17th 03 11:07 PM


All times are GMT +1. The time now is 04:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"