Results 1 to 4 of 4

Thread: Calendar Control help

  1. #1

    Calendar Control help

    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi All

    I'm completely new to VBA and just need guidance on what I'm doing wrong....

    I have a very simple spreadsheet called general to which I want to add a calendar control designed completely using vba coding to it.

    However when I simply pull the object, form and module across to my spreadsheet i encounter all kinds of issues/compile errors/missing library/components etc....and I'm not sure how to get the code across properly...

    I have also attached a second version where I seem to have pulled the code across, however the calendar doesn't work!

    What I would like it to do is activate the calendar control when I click in cell A2:A5000, choose the date and then have it insert it into the cell I selected in the above range.

    The calendar control has been designed by someone else and looking through various posts in other forums it seems to work it must be me and my lack of skills....

    Thanks for any help...
    Attached Files Attached Files

  2. #2
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Nanaimo, BC, Canada
    Blog Entries
    Excel Version
    Excel Office 365 Insider
    Can you provide a link to the other forums where you see the code working correctly? It may help us diagnose the issues.
    Ken Puls, FCPA, FCMA, MS MVP

    Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!

    Main Site: -||- Blog: -||- Forums:
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  3. #3
    You have to change the selection change event like so:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        'The 1st method is coded to launch when a curtain cell is  selected
        If Not Intersect(Target, Range("A2:A5000")) Is Nothing Then
        End If
        'another method is to have it show if a cell that is formatted as a date is selected...see below
        If Target.NumberFormat = "m/d/yy;@" Then
        End If
        'another method is using Select Case...see below
        Select Case Target.NumberFormat
            Case Is = "m/d/yy", "m/d/yyyy", "m/d/yy", "mm/dd/yy", "yyyy-mmm-dd"
            'Case Else
            '    MsgBox "Not a valid date format!"
        End Select
    End Sub
    Jan Karel Pieterse

  4. #4
    Neophyte psawyer's Avatar
    Join Date
    Feb 2012
    Berlin, Germany

    Alternative to calendar control

    Here an alternative to calendar control.
    Attached Files Attached Files

Posting Permissions

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