Tab control from control to cell
Lets get this out of the way...I am using the following for tabbing
between controls in my Excel sheet. -------------------------------------------------------- Private Sub ComboBox103_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Dim bBackwards As Boolean Const ctlPrev As String = "ComboBox102" Const ctlNext As String = "ComboBox104" Select Case KeyCode Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp Application.ScreenUpdating = False bBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp) If Application.Version < 9 Then Sheet1.Range("A1").Select If bBackwards Then Range(ctlPrev).Activate Else ActiveSheet.OLEObjects(ctlNext).Activate End If Application.ScreenUpdating = True End Select End Sub ------------------------------------------------------- This is fine but what If I want the next Item to be a cell in the document, lets say E22. How can I have it tab to that cell and then get E22 to tab away to the next thing I want a tab in? If that makes any sense I would appreciate the help. Thanks as Always, Jason Self --- Message posted from http://www.ExcelForum.com/ |
Tab control from control to cell
Jason ,
Just put the cell address in ctlPrev Const ctlPrev As String = "E2" Out of the way! -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "JasonSelf " wrote in message ... Lets get this out of the way...I am using the following for tabbing between controls in my Excel sheet. -------------------------------------------------------- Private Sub ComboBox103_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Dim bBackwards As Boolean Const ctlPrev As String = "ComboBox102" Const ctlNext As String = "ComboBox104" Select Case KeyCode Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp Application.ScreenUpdating = False bBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp) If Application.Version < 9 Then Sheet1.Range("A1").Select If bBackwards Then Range(ctlPrev).Activate Else ActiveSheet.OLEObjects(ctlNext).Activate End If Application.ScreenUpdating = True End Select End Sub ------------------------------------------------------- This is fine but what If I want the next Item to be a cell in the document, lets say E22. How can I have it tab to that cell and then get E22 to tab away to the next thing I want a tab in? If that makes any sense I would appreciate the help. Thanks as Always, Jason Self --- Message posted from http://www.ExcelForum.com/ |
Tab control from control to cell
I actually figured out just that not to long before you replied. I d
have the question though of once I have tabbed into that cell how I ca convince VBA to let me tab out. In the event of a control object would simply name the object. Private Sub ComboBox102_KeyDown how would I name this if it were refering to a specific cell like ou E -- Message posted from http://www.ExcelForum.com |
Tab control from control to cell
I think you are out of luck. Shapes have a KeyDown event, but cells don 't .
Normal tabbing takes over from then on. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "JasonSelf " wrote in message ... I actually figured out just that not to long before you replied. I do have the question though of once I have tabbed into that cell how I can convince VBA to let me tab out. In the event of a control object I would simply name the object. Private Sub ComboBox102_KeyDown how would I name this if it were refering to a specific cell like our E2 --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 06:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com