Results 1 to 3 of 3

Thread: [RESOLVED] calendar to pop-up when cell is selected

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    11

    Resolved [RESOLVED] calendar to pop-up when cell is selected

    I need a VBA solution to work with Excel 10.
    All I want to do is when select any cell in the range B3:B100, a calendar popup, and then the selected date shall be placed in that cell.
    I do not know how to write a VBA code to do that.
    Would you please help me in to do that?

    Best regards,
    Muhammad Shehata

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: calendar to pop-up when cell is selected

    you can try like
    Code:
    Private Sub DT_CloseUp()
    ActiveCell.Value = DT.Value
    DT.Visible = False
    End Sub
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count = 1 Then
        If Not Intersect(Target, Range("b3:b100")) Is Nothing Then
            DT.Value = Date
            DT.Visible = True
            DT.Top = Target.Top
        End If
    End If
    End Sub
    in this case DT is a datepicker control on the worksheet, set to visible = false
    Last edited by westconn1; Aug 17th, 2017 at 05:03 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2017
    Posts
    11

    Re: calendar to pop-up when cell is selected

    Many thanks dear westconn1 .. you solve it very quickly and in a clever way

Posting Permissions

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



Click Here to Expand Forum to Full Width