I would use a slightly modified version of my original second block of code:
' This must go in at the top of the code for your userform.
Dim displayDate As Date
' This was the test() macro. No need to put it elsewhere, so just attach
' it directly to the event of interest.
Private Sub Today_Enter()
Load DatePick
' The following shows how to place the calendar position at the calling control position,
' if that is useful to you.
' DatePick.startupposition = 3
' DatePick.Left = Today.Parent.Left + Today.Left
' DatePick.Top = Today.Parent.Top + Today.Top
' Note: If date not supplied to DatePick, current date will be used.
Call DatePick.FillVars()
DatePick.Show
' In mm/dd/yyyy form. Mix and match as desired.
Today.Text = DatePart("m", displayDate) & "/" & DatePart("d", displayDate) & "/" & DatePart("yyyy", displayDate)
End Sub
' This must be included somewhere in the userform code. Must NOT be marked Private
Sub returnDate(dD As Date)
displayDate = dD
End Sub
I'm glad the code works for you. I realize that it's expanded considerably more than you needed in the past few days - your question just gave me an excuse to embark on a small project that I've had waiting for a while.
