Could anyone suggest how I might simplify the following. I have many comboboxes in a worksheet and I want it so that when someone is in the combobox and they press "enter" then you move to the next cell. Right now I make a vba code for each combobox and I know theres a simple way to cycle through them. Take a look at the code and let me know what you think.
Thanks!
Private Sub ComboBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 39 Then
Range("C5").Activate
End If
End Sub
Private Sub ComboBox2_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 39 Then
Range("C6").Activate
End If
End Sub
Private Sub ComboBox3_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 39 Then
Range("C7").Activate
End If
End Sub
Private Sub ComboBox4_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 39 Then
Range("C8").Activate
End If
End Sub
Private Sub ComboBox5_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Or KeyCode = 39 Then
Range("C9").Activate
End If
End Sub
This goes on until ComboBox 41.
Bookmarks