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.

Macro Filtrar por fecha y generar CSV

publicado

Hola a todos

 

Tengo el siguiente caso, espero que alguien me pueda apoyar. El siguiente archivo de Excel está con varias columnas y datos que los guardo por medio de una macro en la unidad “C”, en formato CSV y con ciertos campos como lo es la Clave|Fecha de Baja|Causal| esta información se llena de los mismos campos que contiene el archivo, si embargo debo hacerlo por rango de período, es decir del 1 al 15 y despues del 16 al 31 de cada mes, por lo que me gustaría que por medio de una macro me permita solamente filtrar el rango que corresponda y que dicha macro tome la información y la generé en formato CSV.

No se si sea posible que me al momento de que se generé el archivo, me permita seleccionar la ruta donde lo quiera almacenar y una vez guardado, me indique cuantos registro se crearon, este dato lo puede tomar solamente de una columna, esto me sirve para validar que sean los registros que se van a generar en sistema.

 

Muchas gracias por su tiempo y apoyo y esperando que alguien me pueda apoyar.

Adjunto ejemplo

asi sería en la hoja de excel:

Clave Nombre del empleado Fecha de Baja     CLAVE F.BAJA CAUSAL
6341 JUAN  01     6341 20220201 2
464 PEDRO 02     464 20220202 2
2237 MARIA 03     2237 20220203 2
1924 IVAN 04     1924 20220204 2
2555 OMAR 05     2555 20220205 2
1929 OSACAR 06     1929 20220206 2
2530 CASIMIRO 14     2530 20220214 2
1922 LUNA  08     1922 20220208 2
1772 MORENO 09     1772 20220209 2
1810 SANCHEZ 15     1810 20220215 2
2504 LOPEZ 16     2504 20220216 2
654 JUAN  18     654 20220218 2
1770 IRMA 19     1770 20220219 2
1930 CASANDRA 15     1930 20220215 2
1843 HERMILIO 20     1843 20220220 2
6275 ABRAHAN 29     6275 20220229 2
1817 GIL 30     1817 20220230 2
1925 NOE 31     1925 20220231 2
2556 SANDRA 23     2556 20220223 2
1245 KAREN 22     1245 20220222 2

macro actual:

Sub guardarcsv()
'pega cuentas
Sheets("LAYOUT").Select
    Cells.Select
    Selection.ClearContents
    Sheets("BAJAS").Select
    Columns("F:H").Select
    Selection.Copy
    Sheets("layout").Select
    Columns("A:A").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("B5").Select
    Sheets("layout").Select
    Range("A1").Select
'Crea el CSV
Sheets("layout").Select
Range("A2:C80").Copy
Workbooks.Add
ActiveSheet.Paste Destination:=Range("a1")
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\Layout\Bajas.csv", _
FileFormat:=xlCSV, CreateBackup:=False
ActiveWindow.Close
Application.DisplayAlerts = True
End Sub
 

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.