David1976
12-17-2016, 03:59 AM
Hi all,
First of all, I can't get ComboBox to show first item in ComboBox.
Private Sub ENTER_Click()
Dim newdata As Variant
Dim temp As Integer
Dim X As Integer
temp = 21
ComboBox.Clear
Sheet2.Activate
X = WorksheetFunction.CountA(Range("A:A")) - temp
newdata = TextBox
Cells(X, 2).Value = newdata
End Sub
Private Sub ComboBox_Change()
ComboBox.AddItem "Red", 0
ComboBox.AddItem "Blue", 1
ComboBox.AddItem "Green", 2
ComboBox.AddItem "White", 3
ComboBox.AddItem "Yellow", 4
ComboBox.AddItem "Purple", 5
WorkInProgess
End Sub
'
Private Sub WorkInProgess()
If ComboBox.Text = "Red" Then
Else
Failed
End If
End Sub
Private Sub Failed()
Unload Me
End Sub
Private Sub btnExit_Click()
Unload Me
End Sub
Next I don't really understand
X = WorksheetFunction.CountA(Range("A:A"))
I have used Failed() to Exit program on condition. I don't want the code to proceed after a condition isn't true.
First of all, I can't get ComboBox to show first item in ComboBox.
Private Sub ENTER_Click()
Dim newdata As Variant
Dim temp As Integer
Dim X As Integer
temp = 21
ComboBox.Clear
Sheet2.Activate
X = WorksheetFunction.CountA(Range("A:A")) - temp
newdata = TextBox
Cells(X, 2).Value = newdata
End Sub
Private Sub ComboBox_Change()
ComboBox.AddItem "Red", 0
ComboBox.AddItem "Blue", 1
ComboBox.AddItem "Green", 2
ComboBox.AddItem "White", 3
ComboBox.AddItem "Yellow", 4
ComboBox.AddItem "Purple", 5
WorkInProgess
End Sub
'
Private Sub WorkInProgess()
If ComboBox.Text = "Red" Then
Else
Failed
End If
End Sub
Private Sub Failed()
Unload Me
End Sub
Private Sub btnExit_Click()
Unload Me
End Sub
Next I don't really understand
X = WorksheetFunction.CountA(Range("A:A"))
I have used Failed() to Exit program on condition. I don't want the code to proceed after a condition isn't true.