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.

Error al imprimir

publicado

Buenas tardes.

Tengo una macro que selecciona un rango de celdas para imprimir. La macro la tengo en Hoja1 y las celdas que quiero imprimir están en Hoja2. Si coloco la macro en Hoja2 para imprimir, la macro corre bien, sin embargo, si coloco la macro en Hoja1 y la ejecuto desde esa página me salta error.

Estoy en Hoja1 y quiero imprimir las celdas de Hoja2 con el siguiente código y me salta error:

Sub ImprimirTicket()
    Sheets("Hoja2").Range("O2:R10").Select
    Sheets("Hoja2").PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False

End Sub

Sin embargo, teniendo la macro en Hoja1, si le hago un apaño dirigiéndome a Hoja2 y regresando a Hoja1 funciona la macro.

Sub ImprimirTicket()
	Sheets("Hoja2").Select 'Voy a hoja2
    Sheets("Hoja2").Range("O2:R10").Select
    Sheets("Hoja2").PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
	Sheets("Hoja1").Select 'Regreso a la hoja donde tengo la macro, hoja1
End Sub

 

¿Alguna idea de por qué ocurre esto y cómo podría evitar este apaño de forma más óptima?

Gracias.

Featured Replies

publicado
Sub ImprimirTicket()
    Sheets("Hoja2").Range("O2:R10").PrintOut
End Sub

Pon la macro donde quieras.

Editado el por Antoni

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

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.