ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
I recently changed a value in the settings to show proper dates as opposed text dates.
Now after a fews days & using my other forms i see two which show dates like 9/24/2024 & so i need it to correctly show 24/09/2024
Below are the two Userform_Initialize codes in question but im unable to get the date shown correctly when usng the following code attempt.
FORM 1
FORM2
Now after a fews days & using my other forms i see two which show dates like 9/24/2024 & so i need it to correctly show 24/09/2024
Below are the two Userform_Initialize codes in question but im unable to get the date shown correctly when usng the following code attempt.
Rich (BB code):
ListBox1.Value = Format(CDbl(Date), "dd/mm/yyyy")
FORM 1
VBA Code:
Private Sub UserForm_Initialize()
Dim fndRng As Range
Dim firstAddress As String
Dim cnt As Long
Dim elapsedDays As Long
With Me.ListBox1
.ColumnCount = 9
.ColumnWidths = "220;170;110;170;120;30;130;0"
End With
With Sheets("POSTAGE").Range("G:G")
Set fndRng = .Find(What:="DELIVERED NO SIG", LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not fndRng Is Nothing Then
firstAddress = fndRng.Address
Do ' check the date
elapsedDays = Date - DateValue(fndRng.Offset(, -6))
If elapsedDays <= 80 And elapsedDays >= 30 Then
cnt = cnt + 1
With Me.ListBox1 ' ADD VALUES TO LISTBOX
.AddItem fndRng.Offset(, -5).Value 'CUSTOMER'S NAME
.List(.ListCount - 1, 1) = fndRng.Offset(, -4).Value 'ITEM
.List(.ListCount - 1, 2) = fndRng.Offset(, -6).Value 'DATE
.List(.ListCount - 1, 3) = fndRng.Offset(, -2).Value 'TRACKING NUMBER
.List(.ListCount - 1, 4) = fndRng.Offset(, 5).Value 'CLAIM
.List(.ListCount - 1, 6) = fndRng.Value 'RECEIVED NO SIG
.List(.ListCount - 1, 8) = fndRng.Row
End With
End If
Set fndRng = .FindNext(fndRng)
Loop While Not fndRng Is Nothing And fndRng.Address <> firstAddress
End If
End With
If cnt = 0 Then
MsgBox "THERE ARE " & cnt & " RECORDS FOR WITHIN THE LAST 80 DAYS", vbInformation, "DELIVERED BUT NO SIGNATURE MESSAGE"
End
End If
Me.StartUpPosition = 0
Me.Top = Application.Top + 100 ' MARGIN FROM TOP OF SCREEN
Me.Left = Application.Left + Application.Width - Me.Width - 70 ' LEFT / RIGHT OF SCREEN
End Sub
FORM2
Code:
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
On Error GoTo End_here
Call add_val("LOST")
Call add_val("DELIVERED NO SIG")
Call add_val("RETURNED")
Call add_val("UNKNOWN")
End_here: Application.ScreenUpdating = True
End Sub