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 hojas de excel con fechas

publicado

Buenas tardes,

Necesito un libro de excel en la que con una macro, copie una hoja las veces que sean y que lo nombre del 01 de enero hasta el 31 de diciembre. Es posible???

os adjunto archivo en el que tengo la macro pero nombra a las hojas con números.

muchas gracias

prueba.xlsm

Featured Replies

publicado
Sub GenerarAño()
Application.ScreenUpdating = False
año = InputBox("Indique el año")
inicio = CDate("01/01/" & año)
fin = CDate("31/12/" & año)
For fecha = inicio To fin
   Sheets(1).Copy After:=Sheets(Sheets.Count)
   Sheets(Sheets.Count).Name = Replace(fecha, "/", "-")
Next
End Sub

 

publicado
  • Autor
hace 20 minutos , Antoni dijo:
Sub GenerarAño()
Application.ScreenUpdating = False
año = InputBox("Indique el año")
inicio = CDate("01/01/" & año)
fin = CDate("31/12/" & año)
For fecha = inicio To fin
   Sheets(1).Copy After:=Sheets(Sheets.Count)
   Sheets(Sheets.Count).Name = Replace(fecha, "/", "-")
Next
End Sub

 

Muchas gracias Antoni y perdona por mi abuso ya que veo estás muy preparado; supongo que si quiere hacerlo mensual tendría que poner en vez de "indique el año" poner el mes, no??

publicado
  • Autor
hace 37 minutos , Antoni dijo:
Sub GenerarAño()
Application.ScreenUpdating = False
año = InputBox("Indique el año")
inicio = CDate("01/01/" & año)
fin = CDate("31/12/" & año)
For fecha = inicio To fin
   Sheets(1).Copy After:=Sheets(Sheets.Count)
   Sheets(Sheets.Count).Name = Replace(fecha, "/", "-")
Next
End Sub

 

perdona Antoni, es poniendo el mes... muchísimas gracias, eres mortaaaaaaaaaa

publicado
Sub GenerarMes()
Application.ScreenUpdating = False
año = InputBox("Indique el año (aaaa)")
mes = InputBox("Indique el mes (mm)")
inicio = CDate("01/" & mes & "/" & año)
fecha = inicio
Do Until Month(fecha) <> Month(inicio)
   Sheets(1).Copy After:=Sheets(Sheets.Count)
   Sheets(Sheets.Count).Name = Replace(fecha, "/", "-")
   fecha = fecha + 1
Loop
End Sub

 

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.