ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel crashes everytime I send focus from control to worksheet (https://www.excelbanter.com/excel-programming/363901-excel-crashes-everytime-i-send-focus-control-worksheet.html)

Daves_Solutions[_2_]

Excel crashes everytime I send focus from control to worksheet
 
I have an embedded control in my spreadsheet and everytime that the user
presses the tab key I send the focus to the next cell adjacent to the
control. However each time that this little piece of code runs it crashes
excel.

If I put a text box in the cell and send the focus to the textbox I incur no
problems.

Any explanations or help that you can give me would be greatly appreciated.
Thanks in advance!


Greg Wilson

Excel crashes everytime I send focus from control to worksheet
 
Assuming a combobox added from the Control Toolbox tool bar, this works fine
for me:

Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If KeyCode = 9 Then
ComboBox1.TopLeftCell(1, 4).Select
Selection.Value = ComboBox1.Text
End If
End Sub

Regards,
Greg

"Daves_Solutions" wrote:

I have an embedded control in my spreadsheet and everytime that the user
presses the tab key I send the focus to the next cell adjacent to the
control. However each time that this little piece of code runs it crashes
excel.

If I put a text box in the cell and send the focus to the textbox I incur no
problems.

Any explanations or help that you can give me would be greatly appreciated.
Thanks in advance!


Daves_Solutions[_2_]

Excel crashes everytime I send focus from control to worksheet
 


"Greg Wilson" wrote:

Assuming a combobox added from the Control Toolbox tool bar, this works fine
for me:

Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If KeyCode = 9 Then
ComboBox1.TopLeftCell(1, 4).Select
Selection.Value = ComboBox1.Text
End If
End Sub

Regards,
Greg

"Daves_Solutions" wrote:

I have an embedded control in my spreadsheet and everytime that the user
presses the tab key I send the focus to the next cell adjacent to the
control. However each time that this little piece of code runs it crashes
excel.

If I put a text box in the cell and send the focus to the textbox I incur no
problems.

Any explanations or help that you can give me would be greatly appreciated.
Thanks in advance!

Thanks, this works fine on my developing computer so I (assume) it will be
fine at work. I appreciate it.


All times are GMT +1. The time now is 07:03 AM.

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