Consulting

Results 1 to 4 of 4

Thread: Solved: Userform - Populate textbox with result from popup

  1. #1
    VBAX Tutor phendrena's Avatar
    Joined
    Oct 2008
    Location
    Huddersfield, UK
    Posts
    285
    Location

    Solved: Userform - Populate textbox with result from popup

    Hi,

    I've got two userforms.
    The second userform is a calendar.

    I want the date picked from the calendar to be placed into the field txtDate on userform1. How can i do this? I'm adapting the code from code I have that places the data into the current cell....
    [vba]
    Private Sub frmCalendar_Click()
    ActiveCell = frmCalendar.Value
    ActiveCell.NumberFormat = "dd/mm/yyyy"
    End Sub

    Private Sub UserForm_Activate()
    If IsDate(ActiveCell.Value) Then
    frmCalendar.Value = DateValue(ActiveCell.Value)
    Else
    frmCalendar.Value = Date
    End If
    End Sub
    [/vba]
    How can i get it to be entered into the userform rather than the worksheet cell. I know i'm going to need to change the ActiveCell but to what.

    Thanks,
    Somewhere in the dark and nasty regions where nobody goes, stands an ancient castle.
    Deep within this dank and uninviting place lives Berk, overworked servant of The Thing Upstairs.
    But thats nothing compared to the horrors that lurk beneath The Trap Door.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    [vba]

    Private Sub frmCalendar_Click()
    frmMaster.TextBox1 = Format(frmCalendar.Value, "dd/mm/yyyy")
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Tutor phendrena's Avatar
    Joined
    Oct 2008
    Location
    Huddersfield, UK
    Posts
    285
    Location
    Many thanks.
    Somewhere in the dark and nasty regions where nobody goes, stands an ancient castle.
    Deep within this dank and uninviting place lives Berk, overworked servant of The Thing Upstairs.
    But thats nothing compared to the horrors that lurk beneath The Trap Door.

  4. #4
    VBAX Tutor phendrena's Avatar
    Joined
    Oct 2008
    Location
    Huddersfield, UK
    Posts
    285
    Location
    One further quick question....
    The calendar popsup when they double click, how would i get it to popup when they enter the cell (via tabbing)...?

    Cheers
    Somewhere in the dark and nasty regions where nobody goes, stands an ancient castle.
    Deep within this dank and uninviting place lives Berk, overworked servant of The Thing Upstairs.
    But thats nothing compared to the horrors that lurk beneath The Trap Door.

Posting Permissions

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