ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Evening,
I am using the code supplied below.
On my worksheet i have a date transfer button.
What shappens is the customers receives his parcel.
I open my userform & in the drop down list select that customers name.
I then press the date transfer button & todays date is then put in the cell in column G alongside the customers name.
This works perfect.
I have noticed that if i press the date transfer button without selecting a customers name as opposed to seeing a msgbox saying Please Select A Customer etc i actually see a RUN TIME ERROR 381 message.
Could not get the list property . Invalid property array index.
When i debug i see this line in yellow
wName = NameForDateEntryBox.List(NameForDateEntryBox.ListIndex)
I am using the code supplied below.
On my worksheet i have a date transfer button.
What shappens is the customers receives his parcel.
I open my userform & in the drop down list select that customers name.
I then press the date transfer button & todays date is then put in the cell in column G alongside the customers name.
This works perfect.
I have noticed that if i press the date transfer button without selecting a customers name as opposed to seeing a msgbox saying Please Select A Customer etc i actually see a RUN TIME ERROR 381 message.
Could not get the list property . Invalid property array index.
When i debug i see this line in yellow
wName = NameForDateEntryBox.List(NameForDateEntryBox.ListIndex)
Code:
Private Sub DateTransferButton_Click()'Dantes code
Dim sh As Worksheet
Dim b As Range
Dim wName As String, res As Variant
If NameForDateEntryBox = -1 Then
MsgBox "Please Select A Customer", vbCritical, "Delivery Parcel Date Transfer"
Exit Sub
End If
If TextBox7.Value = "" Or Not IsDate(TextBox7.Value) Then
MsgBox "Please Enter A Valid Date", vbCritical, "Delivery Parcel Date Transfer"
TextBox7 = ""
TextBox7.SetFocus
Exit Sub
End If
wName = NameForDateEntryBox.List(NameForDateEntryBox.ListIndex)
Set sh = Sheets("POSTAGE")
Set b = sh.Columns("B").Find(wName, LookIn:=xlValues, lookat:=xlWhole)
If Not b Is Nothing Then
If sh.Cells(b.Row, "G").Value <> "" Then
MsgBox "DATE HAS BEEN ENTERED ALREADY !" & vbCrLf & "Click OK To Go Check It Out ", vbCritical, "Delivery Parcel Date Transfer"
TextBox7 = ""
Unload PostageTransferSheet
Cells(b.Row, "G").Select
Else
sh.Cells(b.Row, "G").Value = CDate(TextBox7.Value)
MsgBox "Delivery Date Updated", vbInformation, "Delivery Parcel Date Transfer"
End If
End If
NameForDateEntryBox = ""
TextBox7 = ""
TextBox7.Value = Format(CDbl(Date), "dd/mm/yyyy")
End Sub