Muchas gracias por el apoyo, adjunto nueva imagen y el codigo realizado (una diculpa un poco largo), espero este mas claro mi caso.
![](//blob.todoexpertos.com/uploads/md/e2df512c5145e8ced6384772450eda72.jpg)
El codigo lo que hace es ContarSI se cumplen los criterios, hasta el momento si me los cuenta pero requiero consultar la informacion por rango de fechas. El codigo:
Private Sub btn_Buscar_Click()
Dim i As Double
Dim Final As Double
Final = Application.CountA(Worksheets("DATOS").Range("tecasig"))
Final1 = Application.CountA(Worksheets("CLIENTES").Range("tcliente"))
For i = 2 To Final
Nombres = Worksheets("DATOS").Cells(i, 3).Value
Sreal = Worksheets("DATOS").Cells(i, 16).Value
tecliente = Worksheets("CLIENTES").Cells(i, 6).Value
'/////////////// Busca los equipos Asignados al Técnico////////////////
If Nombres = txt_tecnico1 Then
txt_tecliente1 = Application.CountIf(Worksheets("CLIENTES").Range("F2:F" & Final1), Nombres)
End If
If Nombres = txt_tecnico2 Then
txt_tecliente2 = Application.CountIf(Worksheets("CLIENTES").Range("F2:F" & Final1), Nombres)
End If
If Nombres = txt_tecnico3 Then
txt_tecliente3 = Application.CountIf(Worksheets("CLIENTES").Range("F2:F" & Final1), Nombres)
End If
If Nombres = txt_tecnico4 Then
txt_tecliente4 = Application.CountIf(Worksheets("CLIENTES").Range("F2:F" & Final1), Nombres)
End If
If Nombres = txt_tecnico5 Then
txt_tecliente5 = Application.CountIf(Worksheets("CLIENTES").Range("F2:F" & Final1), Nombres)
End If
'////////////// Calculo de Preventivos ////////////////////
If Nombres = txt_tecnico1 _
And Sreal = "PREVENTIVO" Then
txt_ptec1 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
If Nombres = txt_tecnico2 _
And Sreal = "PREVENTIVO" Then
txt_ptec2 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
If Nombres = txt_tecnico3 _
And Sreal = "PREVENTIVO" Then
txt_ptec3 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
If Nombres = txt_tecnico4 _
And Sreal = "PREVENTIVO" Then
txt_ptec4 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
If Nombres = txt_tecnico5 _
And Sreal = "PREVENTIVO" Then
txt_ptec5 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
'////////////// Calculo de Correctivos ////////////////////
If Nombres = txt_tecnico1 _
And Sreal = "CORRECTIVO" Then
txt_ctec1 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
If Nombres = txt_tecnico2 _
And Sreal = "CORRECTIVO" Then
txt_ctec2 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
If Nombres = txt_tecnico3 _
And Sreal = "CORRECTIVO" Then
txt_ctec3 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
If Nombres = txt_tecnico4 _
And Sreal = "CORRECTIVO" Then
txt_ctec4 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
If Nombres = txt_tecnico5 _
And Sreal = "CORRECTIVO" Then
txt_ctec5 = Application.CountIfs(Worksheets("DATOS").Range("p2:p" & Final), Sreal, Worksheets("DATOS").Range("c2:c" & Final), Nombres)
End If
Next
End Sub
Private Sub UserForm_Initialize()
' Cargamos los tecnicos actuales
Me.txt_tecnico1.Value = Hoja2.Cells(2, 2)
Me.txt_tecnico2.Value = Hoja2.Cells(3, 2)
Me.txt_tecnico3.Value = Hoja2.Cells(4, 2)
Me.txt_tecnico4.Value = Hoja2.Cells(5, 2)
Me.txt_tecnico5.Value = Hoja2.Cells(8, 2)
End Sub