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
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
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.
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