Lobsterboy1
Board Regular
- Joined
- Aug 5, 2016
- Messages
- 90
Hi,
I have a userform that with some code that I am having a problem with, my code is
I am getting an error on the lines underlined. The error is "run time error '380' Could not set the Text Property. Invalid property value."
I think it is because the combobox's are set to only allow data from the dropdown list and there is no blank in the list. How do I get the userform to reset to all the boxes blank at the end of my code.
Cheers for any help.
I have a userform that with some code that I am having a problem with, my code is
Rich (BB code):
Private Sub CommandButton1_Click()
Dim shp As Control
Dim Txt As String
For Each shp In Me.Controls
If TypeName(shp) = "TextBox" Or TypeName(shp) = "ComboBox" Then
If shp.value = vbNullString Then
Txt = Txt & Chr(10) & shp.Name
End If
End If
Next shp
If Not Txt = vbNullString Then
MsgBox """No Values In """ & Chr(10) & Mid(Txt, 2)
Exit Sub
End If
Range("A1").Select
ActiveCell.End(xlDown).Select
lastrow = ActiveCell.Row
Cells(lastrow + 1, 1).value = DATETXT.Text
Cells(lastrow + 1, 2).value = SHIFTCBOX.Text
Cells(lastrow + 1, 3).value = EMPLOYEECBOX.Text
Cells(lastrow + 1, 4).value = ITEMCBOX.Text
Cells(lastrow + 1, 5).value = QTYTXT.Text
Range("A2").Select
DATETXT.Text = ""
SHIFTCBOX.Text = ""
EMPLOYEECBOX.Text = ""
ITEMCBOX.Text = ""
QTYTXT.Text = ""
End Sub
I am getting an error on the lines underlined. The error is "run time error '380' Could not set the Text Property. Invalid property value."
I think it is because the combobox's are set to only allow data from the dropdown list and there is no blank in the list. How do I get the userform to reset to all the boxes blank at the end of my code.
Cheers for any help.