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.

Copiar datos selección columnas tabla a nuevo excel

publicado

Buenos días, 

Quiero copiar datos de ciertas columnas de una tabla del LibroOrigen a un nuevo libro ( LibroDestino)

He conseguido crear una macro que funciona cuando están todas las celdas completadas (hoja 2 del archivo adjunto) pero si hay vacío da error (hoja1)

Para seleccionar el rango de celdas origen he seleccionado esto:

'Seleccionar rango de celdas origen

rngOrigen.Select
Set a = Range("K1", Range("K1").End(xlDown))
Set b = Range("L1", Range("L1").End(xlDown))
Set c = Range("O1", Range("O1").End(xlDown))
Set d = Range("P1", Range("P1").End(xlDown))
Set e = Range("Q1", Range("Q1").End(xlDown))
Set f = Range("R1", Range("R1").End(xlDown))
Set g = Range("W1", Range("W1").End(xlDown))

Union(a, b, c, d, e, f, g).Select
Selection.Copy

Además, en el libro original tengo más datos y me gustaría conseguir que me exportara los datos pero referenciando a la tabla y columnas.

Creo que debería ser algo así, pero no sé cómo:

rngOrigen.Select
Set a = tabla CLIENTES columna Id_client
Set b = ..
Set c = ..
Set d = ..
Set e = ..
Set f = ..
Set g = ..

Union(a, b, c, d, e, f, g).Select
Selection.Copy

 

Muchas gracias

LibroOrigen4.xlsm LibroDestino.xlsx

Featured Replies

publicado

Saludos @p.cabot@forcadell.com, mira, cambia esto en tu codigo

'Set a = Range("K1", Range("K1").End(xlDown))
'Set b = Range("L1", Range("L1").End(xlDown))
'Set c = Range("O1", Range("O1").End(xlDown))
'Set d = Range("P1", Range("P1").End(xlDown))
'Set e = Range("Q1", Range("Q1").End(xlDown))
'Set f = Range("R1", Range("R1").End(xlDown))
'Set g = Range("W1", Range("W1").End(xlDown))
'Union(a, b, c, d, e, f, g).Select
'Selection.Copy

por esto otro

Set a = Range("CLIENTES[[#All],[id_client]:[CATEGORIA]]")
Set b = Range("CLIENTES[[#All],[EMPRESA]:[Apellido]]")
Set c = Range("CLIENTES[[#All],[Producto 3]]")
Union(a, b, c).Copy

suerte

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.