Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
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
Default font for pasted text in text boxes - Excel 2007 MS OFFICE USER EIT Excel Discussion (Misc queries) 0 March 25th 10 09:01 PM
How do I convert a text array to a concatenated text cell? Excel. Vargasjc Excel Worksheet Functions 5 December 20th 06 06:35 PM
Text not continuing to wrap for large block of text in Excel cell Mandra Charts and Charting in Excel 1 May 15th 06 07:13 PM
Excel VBA: Worksheet cell .Text property: 1024 bytes text len limit loyso Excel Programming 7 May 3rd 05 02:51 PM
HOW TO CHANGE BAHTTEXT (THAI TEXT) TO ENGLISH TEXT IN EXCEL BASHIR Excel Worksheet Functions 0 March 29th 05 12:49 PM


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

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"