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.

Darme el nombre a un libro excel desde una celda

publicado

Buenos días

Tengo una macro que me abre un Excel y me rellena una serie de datos. Hasta ahí todo correcto.

Pero me gustaría darle un poco mas de utilidad y que me abriera el archivo con el nombre que finalmente deseo guardarlo y lo guardara en la carpeta correspondiente 

 

Sub MetodoAbrirLibro()
Dim rngCopy As Range, rngCopyOT2 As Range, rngOT1 As Range, rngOT2 As Range, cel As Range, cel2 As Range, adres$
Dim wbOr As Workbook, wbDes As Workbook
Dim nombre As String, Ruta As String

Application.ScreenUpdating = False

Set wbOr = ThisWorkbook
Set wbDes = Workbooks.Open("C:\Users\jctorres\Desktop\Partes presenciales\C2020-0136_Carga_Horas (1)2.xls")



With wbOr.Sheets("EPYC1")
    .Range("A8:F108").Copy
    wbDes.Sheets("Personal").Range("A8:F108").PasteSpecial xlPasteValues
    .Range("F2").Copy
    wbDes.Sheets("Personal").Range("G3").PasteSpecial xlPasteValues
    .Range("I2").Copy
    wbDes.Sheets("Personal").Range("H3").PasteSpecial xlPasteValues

    Set rngOT1 = .Range("A:U")
    Set rngCopy = Intersect(rngOT1, Union(.Range("H2"), .Range("H3"), .Range("l2"), .Range("G8:H108"), .Range("J8:K108"), .Range("M8:M108")))
    
    For Each cel In rngCopy
        adres = cel.Address
        wbDes.Sheets("OT1").Range(adres).FormulaR1C1 = cel.Value
        
        Next cel
    End With

Esta es la primera parte del código , esta en el modulo 4.

Gracias de antemano

C2020-0136_Carga_Horas (1)2.xls epycSO REV 1.xlsm

Featured Replies

publicado
En 5/11/2021 at 15:27 , Juan Carlos torres ruiz dijo:

me abriera el archivo con el nombre que finalmente deseo guardarlo y lo guardara en la carpeta correspondiente 

No entiendo tu propuesta. Si todavía no le has cambiado el nombre, ¿Cómo lo vas a abrir con el nombre con el que lo quieres guardar? :huh:

Para guardar el libro abierto, al final del proceso sería:

wbDes.SaveAs "Ruta y nombre"

Si no es esto, por favor explica mejor lo que necesitas.

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.