Quiero relacionar libros de excel pero me depura en esta linea: Hoja.Copy after:=Workbooks(A).Sheets(Workbooks(A).Sheets.Count)
Aqui estan los codigos : esto es para la macro te pondre en negrita el error pero no se xq me tira error
Sub Open_Files()
Dim Hoja As Object
Application.ScreenUpdating = False
Dim X As Variant
X = Application.GetOpenFilename _
("Excel Files (*.xls), *.xls", 2, "Abrir archivos", , True)
If IsArray(X) Then
Workbooks.Add
A = ActiveWorkbook.Name
For y = LBound(X) To UBound(X)
Application.StatusBar = "Importando Archivos: " & X(y)
Workbooks.Open X(y)
b = ActiveWorkbook.Name
For Each Hoja In ActiveWorkbook.Sheets
Hoja.Copy after:=Workbooks(A).Sheets(Workbooks(A).Sheets.Count)
Next
Workbooks(b).Close False
Next
Application.StatusBar = "Listo"
Call Unir_Hojas
End If
Application.ScreenUpdating = False
End Sub
Respuesta de Dante Amor
2