• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Date format, time and date displays as decimal number format

Shanzil

New Member
Hi, need little help here. Im struggling with this VBA code. Not be able to format date in “dd/mm/yyyy” while uploading VBA userform.
And time and date displays as Decimal.
What’s wrong with this code.

>>> use code - tags <<<
Code:
ScTime & ScDuration defined as DATE
Thanks

Private Sub ScDate_AfterUpdate()
ScDate = Format(ScDate, "dd/mm/yyyy")
End Sub

Private Sub ScDuration_Change()
ScDuration = Format(ScDuration, "h:mm")
End Sub

Private Sub ScDuration_AfterUpdate()
ScDuration = Format(ScDuration, "h:mm")
End Sub

Private Sub ScTime_AfterUpdate()
ScTime = Format(ScTime, "hh:mm AM/PM")
End Sub

Private Sub ScTime_Change()
ScTime = Format(ScTime, "hh:mm")
End Sub

Private Sub UserForm_Activate()
ScStatus.RowSource = "=Statuses"
ScDuration.RowSource = "=Duration"
Me.Category.RowSource = "Category"
ScTime.RowSource = "=Times"
Priority.RowSource = "=Priority"
ScTime = Format(ScTime.Text, "hh:mmAM/PM")
ScDuration = Format(Me.ScDuration.Text, "h:mm")

End Sub
71218
 
Last edited by a moderator:
Back
Top