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.

Filtrar datos y separar en diferentes hojas con Macro - error 1004

publicado

Hola,

Encontré este código en internet para una macro para separar los datos de una hoja por medio de filtrado.

El filtro funciona perfectamente, la creación de las hojas también, pero al ciclar para filtrar nuevamente y escribir en la hoja nueva, me manda un error 1004.

Aquí el código:


Sub separar()
Dim arrProductos As Variant, i As Integer, hojaBase As String
arrProductos = Array("001N", "003N", "004N", "005N", "006N", "012A", "012N", "017N")
hojaBase = ActiveSheet.Name

For i = 0 To UBound(arrProductos)
Range("A1").Select
Selection.AutoFilter Field:=2, Criteria1:=arrProductos(i)
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets.Add
[COLOR=#ff0000]ActiveSheet.Paste[/COLOR]
ActiveSheet.Name = arrProductos(i)
Sheets(hojaBase).Select
Next


End Sub[/CODE]

Alguna idea para solucionarlo? el error me lo da en la linea marcada en rojo.

Saludos y gracias adelantadas por la ayuda !

Featured Replies

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.