+ Reply to Thread
Results 1 to 4 of 4

Excel crashes everytime I send focus from control to worksheet

  1. #1
    Daves_Solutions
    Guest

    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!


  2. #2
    Greg Wilson
    Guest

    RE: 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!
    >


  3. #3
    Daves_Solutions
    Guest

    RE: 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.

  4. #4

    Re: Excel crashes everytime I send focus from control to worksheet

    Exchange lots of mouse moves and clicks for a single key press!
    Significantly improve working speed by using shortcuts (hot keys).
    Avoid Repetitive Strain Injury!

    EnergyKey http://www30.webSamba.com/SmartStudio


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1