pop calendar

  • Thread starter Thread starter Stuart WJG
  • Start date Start date
S

Stuart WJG

I have used the pop calendar as suggested from ronebruin.nl using the scpipt
from www.fontstuff.com
Is it possible when using it for the calendar to default to "todays"date
Stuart
 
Stuart

Right-click on the Calendar Form and make sure you have this code under
"View Code"

Option Explicit

' ===================================================
' Code by Martin Green eMail (e-mail address removed)
' Visit my Office Tips web site at www.fontstuff.com
' ===================================================

Private Sub cmdClose_Click()
' Close the UserForm
Unload Me
End Sub

Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Format(Date, "dd-mmm-yy")
End If
End Sub

Private Sub Calendar1_Click()
' Transfer date selected on calendar to active cell
' and close UserForm.
ActiveCell.Value = Format(Calendar1.Value, "dd-mmm-yy")
Unload Me
End Sub


Gord Dibben MS Excel MVP
 
Gord
I have checked the code.It was slightly different. I have amended it to
match your. However every time i try and insert a date from the pop up
calendar it defaults to the 14th October when todays date is 20th
Stuart
 
I cannot replicate your problem.

Private Sub UserForm_Initialize()

should give you current date if no date is in the cell.


Gord
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top