ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,689
- Office Version
- 2007
- Platform
- Windows
Hi,
I believe the code supplied below is what you require.
I have a worksheet database where i send out parcels to customers & once parcel is received i like to make a note of the date on my database.
I have a drop down list on my userform which looks at the worksheet & loads any customers name which doesnt have a delivered date assisgned to them.
Everythings works fine but i need to change / alter one thing that happens.
I click on the drop down & select the customers name.
I then press the transfer button which then enters the date next to that customer in question.
I see a msgbox telling me worksheet updated sucessfully & i then click on ok.
At this point if i look in the drop down list this customers name is tsill there.
It is only gone once i close the userform.
I would like the name to be removed from the drop down list when i see the sucessfull message.
I believe the code supplied below is what you require.
I have a worksheet database where i send out parcels to customers & once parcel is received i like to make a note of the date on my database.
I have a drop down list on my userform which looks at the worksheet & loads any customers name which doesnt have a delivered date assisgned to them.
Everythings works fine but i need to change / alter one thing that happens.
I click on the drop down & select the customers name.
I then press the transfer button which then enters the date next to that customer in question.
I see a msgbox telling me worksheet updated sucessfully & i then click on ok.
At this point if i look in the drop down list this customers name is tsill there.
It is only gone once i close the userform.
I would like the name to be removed from the drop down list when i see the sucessfull message.
Code:
Private Sub DateTransferButton_Click()'Dantes code
Dim sh As Worksheet
Dim b As Range
Dim wName As String, res As Variant
If NameForDateEntryBox.ListIndex = -1 Then
MsgBox "Please Select A Customer Before Pressing Transfer Button", vbCritical, "Delivery Parcel Date Transfer Message"
Exit Sub
End If
If TextBox7.Value = "" Or Not IsDate(TextBox7.Value) Then
MsgBox "Please Enter A Valid Date", vbCritical, "Delivery Parcel Date Transfer Message"
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 Message"
TextBox7 = ""
Unload PostageTransferSheet
Cells(b.Row, "G").Select
Else
sh.Cells(b.Row, "G").Value = CDate(TextBox7.Value)
MsgBox "Delivery Date Updated Sucessfully", vbInformation, "Delivery Parcel Date Transfer Message"
End If
End If
NameForDateEntryBox = ""
TextBox7 = ""
TextBox7.Value = Format(CDbl(Date), "dd/mm/yyyy")
End Sub