Macro imprimir selección varias hojas

Me podrían apoyar con una macro para imprimir la selección de una serie de celdas automáticamente .

Lo que requiero creo es muy fácil pero yo no manejo muy bien las macros

Explicó

Tengo un archivo de Excel 2010 que me manda mi jefe el cual aveces tiene 1 hoja y aveces puede tener hasta 500 hojas lo que yo tengo que hacer es imprimir todas las hojas lo cual hago manual y tardo mucho, todas las hojas son iguales solo cambian los datos que contiene yo requiero imprimir de la celda A1:I1 ala A58:I58 de cada hoja y con formato

Portrait orientation

Letter(21.59cm x27.94cm)

Narrow margin ( left:0.64cm Right:0.64cm)

Y básicamente es todo, lo que quiero es algo que me imprima esa selección automáticamente de cada hoja que tenga el archivo .

1 Respuesta

Respuesta
1

Realiza lo siguiente.

Activa la grabadora de macro.

Selecciona una hoja que vayas a imprimir. Entra al menú de Configuración de página, actualiza los datos de la impresión: Portrait, letter, márgenes, etc.

Regresa a apagar la grabadora de macros.

Toma el código que te generó la macro y lo pones dentro del siguiente código:

Sub Macro2()
'
' Macro2 Macro
'
'
    For Each h In Sheets
        h.Select
        '
        'en esta parte pon el código que te generó la macro
        'fin del código que te generó la macro
        '
        ActiveSheet.PageSetup.PrintArea = "$A$1:$I$58"
        ActiveSheet.PrintOut
    Next
End Sub

Ejemplo del resultado final:

Sub Macro2()
'
' Macro2 Macro
'
'
    For Each h In Sheets
        h.Select
        '
        'en esta parte pon el código que te generó la macro
        With ActiveSheet.PageSetup
            .PrintTitleRows = ""
            .PrintTitleColumns = ""
        End With
        ActiveSheet.PageSetup.PrintArea = ""
        With ActiveSheet.PageSetup
            .LeftHeader = ""
            .CenterHeader = ""
            .RightHeader = ""
            .LeftFooter = ""
            .CenterFooter = ""
            .RightFooter = ""
            .LeftMargin = Application.InchesToPoints(0.708661417322835)
            .RightMargin = Application.InchesToPoints(0.708661417322835)
            .TopMargin = Application.InchesToPoints(0.748031496062992)
            .BottomMargin = Application.InchesToPoints(0.748031496062992)
            .HeaderMargin = Application.InchesToPoints(0.31496062992126)
            .FooterMargin = Application.InchesToPoints(0.31496062992126)
            .PrintHeadings = False
            .PrintGridlines = False
            .PrintComments = xlPrintNoComments
            .PrintQuality = 600
            .CenterHorizontally = False
            .CenterVertically = False
            .Orientation = xlPortrait
            .Draft = False
            .FirstPageNumber = xlAutomatic
            .Order = xlDownThenOver
            .BlackAndWhite = False
            .Zoom = 100
            .PrintErrors = xlPrintErrorsDisplayed
            .OddAndEvenPagesHeaderFooter = False
            .DifferentFirstPageHeaderFooter = False
            .ScaleWithDocHeaderFooter = True
            .AlignMarginsHeaderFooter = True
            .EvenPage.LeftHeader.Text = ""
            .EvenPage.CenterHeader.Text = ""
            .EvenPage.RightHeader.Text = ""
            .EvenPage.LeftFooter.Text = ""
            .EvenPage.CenterFooter.Text = ""
            .EvenPage.RightFooter.Text = ""
            .FirstPage.LeftHeader.Text = ""
            .FirstPage.CenterHeader.Text = ""
            .FirstPage.RightHeader.Text = ""
            .FirstPage.LeftFooter.Text = ""
            .FirstPage.CenterFooter.Text = ""
            .FirstPage.RightFooter.Text = ""
        End With
        'fin del código que te generó la macro
        '
        ActiveSheet.PageSetup.PrintArea = "$A$1:$I$58"
        ActiveSheet.PrintOut
    Next
End Sub

Sal u dos , Dante Amor, No olvides valorar la respuesta.

.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas