ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,737
- Office Version
- 2007
- Platform
- Windows
Good morning,
I have a userform which has a drop down list complete with customers names.
I use this to then add a date to that customer.
This is an example of what i do,
I see that the customer has received his parcel so i select his name from the drop down list & then i press my transfer button.
Pressing the transfer button then adds a date in column G alongside the customer that i had just selected.
This is the code for the transfer button.
Im looking to see how the drop down is populated ??
What i am looking to do is the have the selected customer in the drop down list either change color or have a coloured background.
Just as a visual helper so you know not to select it as its been selected & logged already
I have a userform which has a drop down list complete with customers names.
I use this to then add a date to that customer.
This is an example of what i do,
I see that the customer has received his parcel so i select his name from the drop down list & then i press my transfer button.
Pressing the transfer button then adds a date in column G alongside the customer that i had just selected.
This is the code for the transfer button.
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
Im looking to see how the drop down is populated ??
Code:
Private Sub TextBox2_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) Dim fndRng As Range
Dim findString As String
Dim i As Integer
Dim wsPostage As Worksheet
findString = Me.TextBox2.Value
If Len(findString) = 0 Then Exit Sub
Set wsPostage = ThisWorkbook.Worksheets("POSTAGE")
i = 1
Do
Set fndRng = Nothing
Set fndRng = wsPostage.Range("B:B").Find(What:=findString & Format(i, " 000"), _
LookIn:=xlValues, lookat:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If Not fndRng Is Nothing Then
i = i + 1
Cancel = True
End If
Loop Until fndRng Is Nothing
Me.TextBox2.Value = findString & Format(i, " 000")
Cancel = False
End Sub
What i am looking to do is the have the selected customer in the drop down list either change color or have a coloured background.
Just as a visual helper so you know not to select it as its been selected & logged already