Consulting

Results 1 to 3 of 3

Thread: How to export variable from textbox into a cell after clicking on a button?

  1. #1
    VBAX Regular
    Joined
    May 2016
    Posts
    22
    Location

    How to export variable from textbox into a cell after clicking on a button?

    Hi,
    I've been solving this for 2 days, trying many different code modification without any success.
    I have a user form with button:

    Private Sub RunButtonUrgent_Click()
    Dim VysleOdpoved As Date
    Dim uuu As Date
    
    If UrgentForm.OptionButton1.Value = True Then
    VysleOdpoved = uuu
    Sheets("SCHEDULE").Range("E5").Value = VysleOdpoved
    
    End If
    
    Unload UrgentForm
    End Sub
    ...and a TextBox1 in the same userform:

    Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
    
    Dim yourStringDate As Date
    Dim uu As String
    
    uu = UrgentForm.TextBox1.Value
    yourStringDate = CDate(uu)
    uuu = Format(yourStringDate, "dd/mm/yy hh:mm")
    
    End Sub
    I would like the date uuu to appear in the cell E5 after clicking on the RunButtonUrgent. This code doesn't want to work. It seams that I don't understand some rules. What do I do wrong????
    Thank you!

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Declare uuu before any subs
    Dim uuu As Date 
    
    Private Sub RunButtonUrgent_Click() 
        Dim VysleOdpoved As Date 
         
        If UrgentForm.OptionButton1.Value = True Then 
            VysleOdpoved = uuu 
            Sheets("SCHE
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Regular
    Joined
    May 2016
    Posts
    22
    Location
    Quote Originally Posted by SamT View Post
    Declare uuu before any subs
    Dim uuu As Date 
    
    Private Sub RunButtonUrgent_Click() 
        Dim VysleOdpoved As Date 
         
        If UrgentForm.OptionButton1.Value = True Then 
            VysleOdpoved = uuu 
            Sheets("SCHE
    Thank you so much - It worked!

Tags for this Thread

Posting Permissions

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