Sub
Macro1()
Macro1()
Dim dates
As String
As String
Dim asigna,
close1, close2, pend, pend1 As Range
close1, close2, pend, pend1 As Range
dates =
Format(Date, "mm/dd/yyyy")
Format(Date, "mm/dd/yyyy")
Set asigna
= Sheets("Hoja2").Range("C1:c6")
= Sheets("Hoja2").Range("C1:c6")
Set close1
= Sheets("Hoja2").Range("H1:H11")
= Sheets("Hoja2").Range("H1:H11")
Set close2
= Sheets("Hoja2").Range("I1:I11")
= Sheets("Hoja2").Range("I1:I11")
Set pend =
Sheets("Hoja2").Range("O1:O11")
Sheets("Hoja2").Range("O1:O11")
Set pend1 =
Sheets("Hoja2").Range("P1:P11")
Sheets("Hoja2").Range("P1:P11")
as1 =
WorksheetFunction.CountIf(asigna, "<" & dates)
WorksheetFunction.CountIf(asigna, "<" & dates)
as2 =
WorksheetFunction.CountIf(asigna, dates)
WorksheetFunction.CountIf(asigna, dates)
'Range("C5").Value
= WorksheetFunction.CountIf(asigna, ">" & dates)
= WorksheetFunction.CountIf(asigna, ">" & dates)
ce1 =
WorksheetFunction.CountIfs(close1, "<" & dates, close2, dates)
WorksheetFunction.CountIfs(close1, "<" & dates, close2, dates)
ce2 =
WorksheetFunction.CountIfs(close1, dates, close2, dates)
WorksheetFunction.CountIfs(close1, dates, close2, dates)
ce3 =
WorksheetFunction.CountIfs(close1, ">" & dates, close2, dates)
WorksheetFunction.CountIfs(close1, ">" & dates, close2, dates)
pen1 =
WorksheetFunction.CountIfs(pend, "<" & dates, pend1,
"Si")
WorksheetFunction.CountIfs(pend, "<" & dates, pend1,
"Si")
pen2 =
WorksheetFunction.CountIfs(pend, dates, pend1, "Si")
WorksheetFunction.CountIfs(pend, dates, pend1, "Si")
pen3 =
WorksheetFunction.CountIfs(pend, ">" & dates, pend1,
"Si")
WorksheetFunction.CountIfs(pend, ">" & dates, pend1,
"Si")
pen4 =
WorksheetFunction.CountIfs(pend, "<" & dates, pend1,
"No")
WorksheetFunction.CountIfs(pend, "<" & dates, pend1,
"No")
pen5 =
WorksheetFunction.CountIfs(pend, dates, pend1, "No")
WorksheetFunction.CountIfs(pend, dates, pend1, "No")
pen6 =
WorksheetFunction.CountIfs(pend, ">" & dates, pend1,
"No")
WorksheetFunction.CountIfs(pend, ">" & dates, pend1,
"No")
Set mail =
CreateObject("Outlook.Application")
CreateObject("Outlook.Application")
Set Email =
mail.CreateItem(olMailItem)
mail.CreateItem(olMailItem)
With Email
.Display
.To =
destinatario
destinatario
.cc = cc
.Subject = Asunto
.HTMLBody = "<table bordercolor= black BORDER =
1<td colspan = 2 rowspan = 2>Bandeja de Asignación</td>" _
1<td colspan = 2 rowspan = 2>Bandeja de Asignación</td>" _
& "<td colspan = 3 rowspan = 2>Casos
cerrados</td><td colspan = 6>Bandeja de
pendientes</td><tr>" _
cerrados</td><td colspan = 6>Bandeja de
pendientes</td><tr>" _
& "<td colspan = 3>Por
Correo</td><td colspan = 3>Otro</td><tr><td>Pasados</td><td>Del
día</td>" _
Correo</td><td colspan = 3>Otro</td><tr><td>Pasados</td><td>Del
día</td>" _
& "<td>Pasados</td><td>Del
día</td><td>Adelantados</td><td>Pasados</td><td>Del
día</td><td>Adelantados</td>" _
día</td><td>Adelantados</td><td>Pasados</td><td>Del
día</td><td>Adelantados</td>" _
& "<td>Pasados</td><td>Del
día</td><td>Adelantados</td><tr><td>" &
as1 & "</td><td>" & as2 &
"</td>" _
día</td><td>Adelantados</td><tr><td>" &
as1 & "</td><td>" & as2 &
"</td>" _
&
"<td>" & ce1 & "</td><td>" &
ce2 & "</td><td>" & ce3 &
"</td>" _
"<td>" & ce1 & "</td><td>" &
ce2 & "</td><td>" & ce3 &
"</td>" _
&
"<td>" & pen1 & "</td><td>" &
pen2 & "</td><td>" & pen3 &
"</td>" _
"<td>" & pen1 & "</td><td>" &
pen2 & "</td><td>" & pen3 &
"</td>" _
&
"<td>" & pen4 & "</td><td>" &
pen5 & "</td><td>" & pen6 &
"</td></table>"
"<td>" & pen4 & "</td><td>" &
pen5 & "</td><td>" & pen6 &
"</td></table>"
End With
End Sub------------------------
Option Explicit
Sub PRUYEBA()
Dim mat(1 To 100, 1 To 4) As Variant
Dim a, b, c, d, reg, tb As Long
'a = fila
'b = columna
'reg = registros
'tab = registros en tabla
'c = concatenado
Range("A2").Activate
reg = Range(Selection, Selection.End(xlDown)).Count
For a = 1 To reg
For b = 1 To 4
mat(a, b) = ActiveCell.Offset(0, b - 1).Value
Next b
ActiveCell.Offset(1, 0).Activate
Next a
For tb = 1 To reg
c = c & "<tr><td>" & mat(tb, 1) & "</td><td>" & mat(tb, 2) & "</td><td>" & mat(tb, 3) & "</td><td>" & mat(tb, 4) & "</td></tr>"
Next tb
Range("a15").Value = c
FIN:
Range("a8").Select
For c = 1 To reg
For d = 1 To 4
ActiveCell.Offset(0, d - 1).Value = mat(c, d)
Next d
ActiveCell.Offset(1, 0).Select
Next c
End Sub
No hay comentarios:
Publicar un comentario