Consulting

Results 1 to 4 of 4

Thread: Date Picker Problem

  1. #1
    VBAX Regular
    Joined
    Sep 2007
    Location
    Virginia
    Posts
    49
    Location

    Date Picker Problem

    Hi,

    I used to be able to use the regular calendar control with the following code to pick dates and filter data.

    Private Sub cmdCancel_Click()
        Unload frmCalendar
    End Sub
    
    Private Sub cmdOkay_Click()
        frmCalendar.Hide
    '    Unload frmCalendar
        
    End Sub
    
    Private Sub UserForm_Initialize()
    
    'Set starting conditions
        
        With frmCalendar
            .Calendar1.Value = Date 'Set to Todays Date
            .Calendar1.SetFocus
        End With
    
    End Sub
    But now I can't get it to function with the new code behind the Date Picker I found from Martin Green as follows:

    Private Sub cmdClose_Click()
        Unload Me
    End Sub
    
    Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
        On Error Resume Next
        Dim cell As Object
        For Each cell In Selection.Cells
            cell.Value = DateClicked
        Next cell
        Unload Me
    End Sub
    
    Private Sub UserForm_Initialize()
        If IsDate(ActiveCell.Value) Then
            Me.MonthView1.Value = ActiveCell.Value
        End If
    End Sub
    Is is possible to have this code modified to my particular needs? Instead of inserting a date in a cell I want to use to with other code to filter data.

    frmCalendar.Show
    ManagerDate = frmCalendar!Calendar1.Value
    Thank you in advance if you can help me.

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,877
    If the workbook's only to be used on a few machines, how about making the old dtpicker work - that's what I did long ago on my machine?
    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.

  3. #3
    VBAX Regular
    Joined
    Sep 2007
    Location
    Virginia
    Posts
    49
    Location
    Thank you for responding p45cal. It will be used on anywhere from 50 to 70 different machines as users will be moving from machine to machine.

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,877
    I think we'll need to know just what Martin Green date picker you're using; can you supply a link, or better, attach or link to your workbook, or a version of it?
    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
  •