Consulting

Results 1 to 2 of 2

Thread: set calendar to open at a specified date.

  1. #1
    VBAX Tutor
    Joined
    Jul 2010
    Posts
    225
    Location

    set calendar to open at a specified date.

    Hi guys, have the below code which works great, but is there a way to set the date to 01/01/ & current year, each time it pops up? Right now it opens to todays date only.


    [VBA]Private Sub Calendar1_Click()
    ActiveCell = Calendar1.Value
    ActiveCell.NumberFormat = "mm/dd/yy/h:mm am/pm"
    Unload UserForm1
    End Sub

    Private Sub UserForm_Activate()
    Me.Calendar1.Value = Date
    End Sub
    [/VBA]

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    [VBA]Private Sub UserForm_Activate()
    Me.Calendar1.Value = DateSerial(Year(Date), 1, 1)
    End Sub[/VBA]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •