Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
publicado

Saludos, 

He intentado sin éxito lograr forzar la ubicación de los PageBreaks o saltos de paginas. Este es el código que he intentado. Mi intención es poder forzar la ubicacion de los PageBreaks pero excel los sigue ubicando donde le da la gana. Mi intención es que imprima la última pagina con todas las filas sin importar si solo utilizó las primeras filas de la última pagina. Ideas?

Sub PageSetup()

 

Dim LastRow As Long

Dim Page1 As Long

Dim Page2 As Long

Dim Page3 As Long

 

'valor de la ultima celda escrita en la columna F

LastRow = Cells(Rows.Count, "G").End(xlUp).Row

 

'************PRIMERA PAGINA****************************

If LastRow <= 70 Then

 Page1 = 70

 PageSet1 = Page1 - LastRow

FinalPageSet1 = LastRow + PageSet1

 

        With ActiveSheet.PageSetup

            .PrintArea = "B2:L" & FinalPageSet1

            .Zoom = False

            .FitToPagesWide = 1

            .FitToPagesTall = 1

        End With

        

'***********SEGUNDA PAGINA*****************************

 ElseIf LastRow <= 150 Then

 Page2 = 150

 PageSet2 = Page2 - LastRow

FinalPageSet2 = LastRow + PageSet2

 

         With ActiveSheet.PageSetup

            .PrintArea = "B2:L" & FinalPageSet2

            .Zoom = False

            .FitToPagesWide = 1

            .FitToPagesTall = 2

        End With

Worksheets("Sheet1").Rows(71).PageBreak = xlPageBreakManual  

 

'***********TERCERA PAGINA*****************************

ElseIf LastRow <= 230 Then

Page3 = 230

 PageSet3 = Page3 - LastRow

FinalPageSet3 = LastRow + PageSet3

 

        With ActiveSheet.PageSetup

            .PrintArea = "B2:L" & FinalPageSet3

            .Zoom = False

            .FitToPagesWide = 1

            .FitToPagesTall = 3

        End With

Worksheets("Sheet1").Rows(71).PageBreak = xlPageBreakManual  

Worksheets("Sheet1").Rows(151).PageBreak = xlPageBreakManual  

End If

End Sub

Featured Replies

publicado
En 6/11/2024 at 18:50 , DARIEN HERNANDEZ dijo:

Mi intención es que imprima la última pagina con todas las filas sin importar si solo utilizó las primeras filas de la última pagina. Ideas?

tu codigo es muy 'danzarin' y lo (unico ?) que hace es agregar saltos de pagina segun condiciones, pero en ningun lado aparece la instruccion de imprimir (?)

si tu intencion es que se imprima (solo) la ultima pagina ?, al final de tu procedimiento de insertar saltos (ANTES del 'End Sub' ) agrega esta linea:

  ActiveSheet.PrintOut ExecuteExcel4Macro("get.document(50)")

Crear una cuenta o conéctate para comentar

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.