I don't think there's a difference, unless if you are calling a sub which contains UserForm.Show rather than opening the form in the VBE.
What reactions are you having?
Sub Workbook_Open()
UserForm.Show
End Sub
Does the problem only occur when the form is opened with that code?
What is it you are trying to do with the textbox that involves monitoring for Enter being pressed?
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Select Case KeyCode
Case 13
If TextLabel.BackColor = RGB(105, 51, 105) Then
Call SampleMass
ElseIf TextLabel.BackColor = RGB(51, 51, 105) Then
Call ContainerNo
ElseIf TextLabel.BackColor = RGB(51, 255, 255) Then
Call EquipmentCheck
ElseIf TextLabel.BackColor = RGB(51, 102, 255) Then
Call TestNo
ElseIf TextLabel.BackColor = RGB(255, 102, 255) Then
Call RemoveContainer
ElseIf TextLabel.BackColor = RGB(75, 255, 0) Then
Call WeighContainer
ElseIf TextLabel.BackColor = RGB(100, 100, 255) Then
Call ContainerChange
ElseIf TextLabel.BackColor = RGB(125, 255, 125) Then
Call CalculationResult
End If
Case Else
End Select
TextboxFocus.Value = ""
TextboxFocus.Value = "‡"
End Sub
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
Select Case Textlabel.BackColor
Case RGB(105, 51, 105)
Call SampleMass
Case RGB(51, 51, 105)
Call ContainerNo
Case RGB(51, 255, 255)
Call EquipmentCheck
Case RGB(51, 102, 255)
Call TestNo
Case RGB(255, 102, 255)
Call RemoveContainer
Case RGB(75, 255, 0)
Call WeighContainer
Case RGB(100, 100, 255)
Call ContainerChange
Case RGB(125, 255, 125)
Call CalculationResult
End Select
End If
TextboxFocus.Value = ""
TextboxFocus.Value = "‡"
End Sub