Validar datos de un de hoja de excel, textbox y listbox
Saludos Dam, le agregue un tipo de juego al combobox2 eh arreglado todo pero me falta arreglar el macro que validad los textbox.
limite_pale = 50
limite_quin = 100
'Suma el valor de las facturas en la hoja por día
For i = 2 To Range("F" & Rows.Count).End(xlUp).Row
If Cells(i, "C") = "N/A" Then
cellsc = ""
Else
cellsc = Cells(i, "C")
End If
If Mid(Cells(i, "F"), 1, 20) = Mid(ComboBox1, 1, 20) And _
Mid(Cells(i, "G"), 1, 4) = Mid(ComboBox2, 1, 4) And _
Cells(i, "B") = TextBox2 And _
cellsc = TextBox3 And _
Cells(i, "H") = Date Then
If Mid(Cells(i, "F"), 1, 4) = "2-Pale" Then
totfact_pale = totfact_pale + Val(Cells(i, "D"))
Else
totfact_quin = totfact_quin + Val(Cells(i, "D"))
End If
End If
Next
'Suma el valor de lo que va en el listbox
For i = 0 To ListBox1.ListCount - 1
'if ListBox.List(i, 1) =
If Mid(ListBox1.List(i, 5), 1, 5) = Mid(ComboBox2, 1, 5) And _
ListBox1.List(i, 0) = TextBox2 And _
ListBox1.List(i, 1) = TextBox3 Then
If Mid(ListBox1.List(i, 5), 1, 5) = "2-Pale" Then
totfactlist_pale = totfactlist_pale + Val(ListBox1.List(i, 2))
Else
totfactlist_quin = totfactlist_quin + Val(ListBox1.List(i, 2))
End If
End If
Next
'Suma el valor del textbox4
If Mid(ComboBox2, 1, 5) = "2-Pale" Then
If totfact_pale + totfactlist_pale + Round(Val(TextBox4) * 1.1, 0) > limite_pale Then
MsgBox "El valor de Pale va a exceder más de 50", vbCritical, "Error"
TextBox4.SetFocus
Exit Sub
End If
Else
If totfact_quin + totfactlist_quin + Round(Val(TextBox4) * 1.1, 0) > limite_quin Then
MsgBox "El valor de Quiniela va a exceder más de 100", vbCritical, "Error"
TextBox4.SetFocus
Exit Sub
End If
End Ifya que no puedo encontrar por que es que no me valida como la hacia cuando me enviaste el codigo. Gracias
PD: Le cambie los limites ya que para pale es 50 y para quiniela es 100.
1 Respuesta
Respuesta de Dante Amor
1