Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel text box VBA
I've entered a text box into my worksheet from the Control Toolbox toolbar.
When entering text into the box, how can I get the cursor to return to a cell in the worksheet after entry has been completed? I tried the following: Private Sub TextBox1_Change() Range("A1").Select End Sub But the cursor moved to cell A1 as soon as I started typing text in the box. Regards -- R Ormerod |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel text box VBA
You probably want the lost focus event instead fo the change event...
Private Sub TextBox1_LostFocus() Range("A1").Select End Sub -- HTH... Jim Thomlinson "R Ormerod" wrote: I've entered a text box into my worksheet from the Control Toolbox toolbar. When entering text into the box, how can I get the cursor to return to a cell in the worksheet after entry has been completed? I tried the following: Private Sub TextBox1_Change() Range("A1").Select End Sub But the cursor moved to cell A1 as soon as I started typing text in the box. Regards -- R Ormerod |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel text box VBA
Hi,
This works when you enter your text and pres ESC Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If KeyAscii.Value = vbKeyEscape Then Range("A1").Select End If End Sub Cheers, Flemming "R Ormerod" wrote in message ... I've entered a text box into my worksheet from the Control Toolbox toolbar. When entering text into the box, how can I get the cursor to return to a cell in the worksheet after entry has been completed? I tried the following: Private Sub TextBox1_Change() Range("A1").Select End Sub But the cursor moved to cell A1 as soon as I started typing text in the box. Regards -- R Ormerod |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel text box VBA
R,
What will indicate that text entry has finished? If pressing the ENTER key would indicate that data entry is finished, then you can trap it in the Keydown event. Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If KeyCode = 13 Then Range("A1").Select 'EnterkEy End Sub -- Hope that helps. Vergel Adriano "R Ormerod" wrote: I've entered a text box into my worksheet from the Control Toolbox toolbar. When entering text into the box, how can I get the cursor to return to a cell in the worksheet after entry has been completed? I tried the following: Private Sub TextBox1_Change() Range("A1").Select End Sub But the cursor moved to cell A1 as soon as I started typing text in the box. Regards -- R Ormerod |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel text box VBA
Hello Jim,
Just a head's up to the you/OP, but hitting Enter or Return in a Textbox on a worksheet doesn't remove the cursor from the textbox and the textbox doesn't lose focus, so I don't think this will be effective. -- Regards, Tom Ogilvy "Jim Thomlinson" wrote: You probably want the lost focus event instead fo the change event... Private Sub TextBox1_LostFocus() Range("A1").Select End Sub -- HTH... Jim Thomlinson "R Ormerod" wrote: I've entered a text box into my worksheet from the Control Toolbox toolbar. When entering text into the box, how can I get the cursor to return to a cell in the worksheet after entry has been completed? I tried the following: Private Sub TextBox1_Change() Range("A1").Select End Sub But the cursor moved to cell A1 as soon as I started typing text in the box. Regards -- R Ormerod |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Default font for pasted text in text boxes - Excel 2007 | Excel Discussion (Misc queries) | |||
How do I convert a text array to a concatenated text cell? Excel. | Excel Worksheet Functions | |||
Text not continuing to wrap for large block of text in Excel cell | Charts and Charting in Excel | |||
Excel VBA: Worksheet cell .Text property: 1024 bytes text len limit | Excel Programming | |||
HOW TO CHANGE BAHTTEXT (THAI TEXT) TO ENGLISH TEXT IN EXCEL | Excel Worksheet Functions |