Buenas tardes colegas. Espero se encuentren bien de salud.
Acá les traigo otro Proyecto, Este es para controlar la alimentación de los trabajadores de la Lavandería, o sea, alumerzos, comidas y meriendas. Tengo determinado mediante OpptionButton filtros para cada uno de los casos, pero cuando quiero imprimir esos filtros (Botón que se encuentra dentro del Frame, encima del ListBox), todo lo hace a la perfección, pero la suma de que debe hacer de las columnas G e I me falsea el resultado.
Private Sub BtnImprimirRango_Click()
Dim Lin As Long
Dim Uf As Long
Dim I As Integer
Dim X As Long
Dim Suma, Suma1 As Double
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Suma = Application.WorksheetFunction.Sum(Hoja9.Range("I:I"))
Suma1 = Application.WorksheetFunction.Sum(Hoja9.Range("G:G"))
Hoja9.Range("A1:J1000").ClearContents
With Hoja9
.Activate
.Visible = xlSheetVisible
.Select
.Range("A4") = "ID"
.Range("B4") = "NOMBRES Y APELLIDOS"
.Range("C4") = "C. IDENTIDAD "
.Range("D4") = "CATEGORíA"
.Range("E4") = "FECHA"
.Range("F4") = "MERIENDA"
.Range("G4") = "CANTIDAD"
.Range("H4") = "PRECIO"
.Range("I4") = "IMPORTE"
Uf = Hoja9.Range("A" & Rows.Count).End(xlUp).Row + 1
For I = 0 To LstBDMerienda.ListCount - 1
.Range("I" & Uf + 3).ClearContents
.Range("G" & Uf + 3).ClearContents
.Range("A" & Uf) = LstBDMerienda.List(I, 0)
.Range("B" & Uf) = LstBDMerienda.List(I, 1)
.Range("C" & Uf) = LstBDMerienda.List(I, 2)
.Range("D" & Uf) = LstBDMerienda.List(I, 3)
.Range("E" & Uf) = LstBDMerienda.List(I, 4)
.Range("F" & Uf) = LstBDMerienda.List(I, 5)
.Range("G" & Uf) = LstBDMerienda.List(I, 6)
.Range("H" & Uf) = LstBDMerienda.List(I, 7)
.Range("I" & Uf) = LstBDMerienda.List(I, 8)
Uf = Uf + 1
Next I
.Columns("A:I").AutoFit
.Columns("A:A").HorizontalAlignment = xlCenter
.Columns("F:F").HorizontalAlignment = xlCenter
.Columns("G:G").HorizontalAlignment = xlCenter
.Range("A4,B4,C4,D4,E4,F4,G4,H4,I4").Font.Bold = True
.Range("A4,B4,C4,D4,E4,F4,G4,H4,I4").HorizontalAlignment = xlCenter
.Range("B1") = "LAVANDERÍA AT CAYO COCO"
.Range("B1").Interior.Color = RGB(30, 144, 255)
.Range("B2:C2").Interior.Color = RGB(30, 144, 255)
.Range("B1").Font.Bold = True
.Range("B2") = "REPORTE DE PERSONAL CON MERIENDA"
.Range("B2").Font.Bold = True
.Range("E3") = "REALIZADO EL DIA : " & CDate(Date)
.Range("E3").Font.Bold = True
.Range("F" & Uf + 3) = "Totales"
.Range("F" & Uf + 3).Font.Bold = True
.Range("I" & Uf + 3) = FormatNumber(Suma, 2)
.Range("G" & Uf + 3) = FormatNumber(Suma1, 2)
.Range("G" & Uf + 3).Font.Bold = True
.Range("I" & Uf + 3).Font.Bold = True
.Range("I" & Uf + 3).Font.Underline = True
.Range("H" & Uf + 3).HorizontalAlignment = xlRight
End With
Sheets("Reporte3").Select
X = Application.Dialogs(xlDialogPrinterSetup).Show
If X = False Then Exit Sub
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
MsgBox "Información enviada a la Impresora con Éxito", vbInformation, "Sistemas COLOSSUS"
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Buenas tardes colegas. Espero se encuentren bien de salud.
Acá les traigo otro Proyecto, Este es para controlar la alimentación de los trabajadores de la Lavandería, o sea, alumerzos, comidas y meriendas. Tengo determinado mediante OpptionButton filtros para cada uno de los casos, pero cuando quiero imprimir esos filtros (Botón que se encuentra dentro del Frame, encima del ListBox), todo lo hace a la perfección, pero la suma de que debe hacer de las columnas G e I me falsea el resultado.
Private Sub BtnImprimirRango_Click() Dim Lin As Long Dim Uf As Long Dim I As Integer Dim X As Long Dim Suma, Suma1 As Double Application.ScreenUpdating = False Application.DisplayAlerts = False Suma = Application.WorksheetFunction.Sum(Hoja9.Range("I:I")) Suma1 = Application.WorksheetFunction.Sum(Hoja9.Range("G:G")) Hoja9.Range("A1:J1000").ClearContents With Hoja9 .Activate .Visible = xlSheetVisible .Select .Range("A4") = "ID" .Range("B4") = "NOMBRES Y APELLIDOS" .Range("C4") = "C. IDENTIDAD " .Range("D4") = "CATEGORíA" .Range("E4") = "FECHA" .Range("F4") = "MERIENDA" .Range("G4") = "CANTIDAD" .Range("H4") = "PRECIO" .Range("I4") = "IMPORTE" Uf = Hoja9.Range("A" & Rows.Count).End(xlUp).Row + 1 For I = 0 To LstBDMerienda.ListCount - 1 .Range("I" & Uf + 3).ClearContents .Range("G" & Uf + 3).ClearContents .Range("A" & Uf) = LstBDMerienda.List(I, 0) .Range("B" & Uf) = LstBDMerienda.List(I, 1) .Range("C" & Uf) = LstBDMerienda.List(I, 2) .Range("D" & Uf) = LstBDMerienda.List(I, 3) .Range("E" & Uf) = LstBDMerienda.List(I, 4) .Range("F" & Uf) = LstBDMerienda.List(I, 5) .Range("G" & Uf) = LstBDMerienda.List(I, 6) .Range("H" & Uf) = LstBDMerienda.List(I, 7) .Range("I" & Uf) = LstBDMerienda.List(I, 8) Uf = Uf + 1 Next I .Columns("A:I").AutoFit .Columns("A:A").HorizontalAlignment = xlCenter .Columns("F:F").HorizontalAlignment = xlCenter .Columns("G:G").HorizontalAlignment = xlCenter .Range("A4,B4,C4,D4,E4,F4,G4,H4,I4").Font.Bold = True .Range("A4,B4,C4,D4,E4,F4,G4,H4,I4").HorizontalAlignment = xlCenter .Range("B1") = "LAVANDERÍA AT CAYO COCO" .Range("B1").Interior.Color = RGB(30, 144, 255) .Range("B2:C2").Interior.Color = RGB(30, 144, 255) .Range("B1").Font.Bold = True .Range("B2") = "REPORTE DE PERSONAL CON MERIENDA" .Range("B2").Font.Bold = True .Range("E3") = "REALIZADO EL DIA : " & CDate(Date) .Range("E3").Font.Bold = True .Range("F" & Uf + 3) = "Totales" .Range("F" & Uf + 3).Font.Bold = True .Range("I" & Uf + 3) = FormatNumber(Suma, 2) .Range("G" & Uf + 3) = FormatNumber(Suma1, 2) .Range("G" & Uf + 3).Font.Bold = True .Range("I" & Uf + 3).Font.Bold = True .Range("I" & Uf + 3).Font.Underline = True .Range("H" & Uf + 3).HorizontalAlignment = xlRight End With Sheets("Reporte3").Select X = Application.Dialogs(xlDialogPrinterSetup).Show If X = False Then Exit Sub ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False MsgBox "Información enviada a la Impresora con Éxito", vbInformation, "Sistemas COLOSSUS" Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub
Intenté con esta otra variante, pero nada....
Suma = Application.WorksheetFunction.Sum(Hoja9.Range("I" & UF +2))
Suma1 = Application.WorksheetFunction.Sum(Hoja9.Range("G" & UF +2))
Por favor, si me pueden ayudar se los agradeceré.
Adjunto archivo
Gracias de antemano.
Pino.
Resumen de Comensales Lavandería.xlsm