Results 1 to 5 of 5

Thread: Return data in text boxes

  1. #1
    Member
    Join Date
    Mar 12
    Posts
    33

    Return data in text boxes

    Hi.
    I need to return to the Textbox's values ​​according to ComboBox1 (el dira the tab name, to return) and ComboBox2 (he will tell you the date the information is returned).
    does not work
    Code:
    Private Sub ComboBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean) 
         
         
        Dim vrNum As String 
        Dim vr1 As String 
        Dim qt As Integer 
         
        qt = Sheets(ComboBox1.Text).[A3].CurrentRegion.Rows.Count 
         
        Application.EnableEvents = False 
         
        On Error Resume Next 
        vrNum = CDate(Me.ComboBox2) 
         
        If vrNum = "" Then 
            MsgBox "Insira uma data valida" 
            Me.ComboBox2 = "" 
            Application.EnableEvents = True 
            Exit Sub 
        Else 
            On Error Resume Next 
            vr1 = Application.WorksheetFunction.VLookup(vrNum, Worksheets(ComboBox1).Range("A3:G" & qt), 2, 0) '=PROCV
             
            Me.TextBox1 = vr1 
            If vr1 = "" Then 
                MsgBox "não possui faturamento." 
            End If 
            Application.EnableEvents = True 
        End If 
    End Sub
    Cross-Post
    http://www.thecodecage.com/forumz/mi...ext-boxes.html
    Thank you!!
    Attached Files Attached Files

  2. #2
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,520

    Re: Return data in text boxes

    does not work
    what does this mean?
    you get error, wrong result or nothing?
    does the code run at all? do you get any message box at all?
    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
    Member
    Join Date
    Mar 12
    Posts
    33

    Re: Return data in text boxes

    Hi.
    I have 2 worksheets named 'AGOSTO' and another called 'SETEMBRO'
    I need the Textbox's return (if TextBox1 .... until TextBox6) if ComboBox1 is 'AGOSTO' then it will be searched in the worksheet 'AGOSTO' and will ComboBox2 statement based on the date.

    after that the data is returned to the Textbox's

  4. #4
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,520

    Re: Return data in text boxes

    i still do not understand what the problem is you are having to put the data in the textboxes
    i can only see code to put data into textbox1
    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

  5. #5
    Member
    Join Date
    Mar 12
    Posts
    33

    Re: Return data in text boxes

    Hi.

    That was what i tried to do.
    But not much of VBA.
    can you help me?
    Thank 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
  •