Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default referring to texbox

Without knowing what "does not work" means...
I would guess that you need a keypress event for each textbox.
Your code only executes if the keypress occurs over the userform not the textboxes.
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware

..
..
..


wrote in message
...
Hi Jim,
Do you know why the option for Keypress does not work.I updated my
code as below:
Dim GameNum As Variant

If KeyAscii = 49 Then
GameNum = Sheet1.Range("game").Value
Label10.Caption = GameNum
Label1.BackColor = &HFFC0C0
Controls.Item("TextBox" & GameNum) = "T"
Sheet1.Range("game") = Sheet1.Range("game") + 1
End If

If KeyAscii = 50 Then
GameNum = Sheet1.Range("game").Value
Label10.Caption = GameNum
Label2.BackColor = &HFF&
Controls.Item("TextBox" & GameNum) = "O"
Sheet1.Range("game") = Sheet1.Range("game") + 1
End If

Exit Sub
If KeyAscii = 51 Then
GameNum = Sheet1.Range("game").Value
Label10.Caption = GameNum
Label2.BackColor = &HFF&
Controls.Item("TextBox" & GameNum) = "O"
Sheet1.Range("game") = Sheet1.Range("game") + 1
End If
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
texbox event update matelot Excel Programming 2 May 29th 07 01:12 AM
How to tab to next from a texbox Corey Excel Programming 2 December 27th 06 01:00 AM
Add texbox to Multipage on worksheet Lucifix[_13_] Excel Programming 0 April 5th 06 07:36 AM
use value in texbox to search through worksheet GEORGIA Excel Discussion (Misc queries) 0 March 29th 05 08:15 PM
OLE Object -TexBox Properties SSR[_2_] Excel Programming 2 December 31st 03 08:22 AM


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

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

About Us

"It's about Microsoft Excel"