I'm having problems with losing focus on textbox when pressing enter. I know there is a similar question already solved, but it just doesn't work for some reason.
This code detects an enter pressed while in the MeasuredDim
textbox and then calls the NextDim_click
sub. NextDim_click
also works through a commandbutton and has also MeasuredDim.SetFocus
included and it works fine through the button press, but when calling NextDim_click
after Enter press, the focus is lost on the whole UserForm.
How is it not working for me?
Private Sub MeasuredDim_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then
Call NextDim_Click
KeyCode = 0
MeasuredDim.SetFocus
End If
End Sub