Unir dos libros en uno con macro

Tengo dos libros de Excel que contienen informaciones independiente el uno del otro. Uno se llama DataBase Arbeitnehmer y el otro DataBase Bewerber. Ambos tienen 5 hojas (Home, Data Base, Rekord, Einfugen, Fotos) El punto es que al unir los dos libros las macro del segundo libro que uni al primero ya no me funcionan. Ambos libros tiene la misma macro.

Sub IngresarDatos()
'
' Ingresar_Datos Macro
'

    Application.ScreenUpdating = False
    Sheets("DataBase Arbeitnehmer").Select
    Range("A5").Select
    Selection.ListObject.ListRows.Add (1)
    Sheets("Arbeitnehmer einfügen").Select
    Range("C6:C24").Select
    Selection.Copy
    Sheets("DataBase Arbeitnehmer").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
        ActiveWorkbook.Worksheets("DataBase Arbeitnehmer").ListObjects("DataBase"). _
        Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("DataBase Arbeitnehmer").ListObjects("DataBase"). _
        Sort.SortFields.Add Key:=Range("DataBase[[#All],[ID No.]]"), SortOn:= _
        xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("DataBase Arbeitnehmer").ListObjects("DataBase" _
        ).Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Sheets("Arbeitnehmer einfügen").Select
    Application.CutCopyMode = False
    Range("C6:C24").Select
    Selection.ClearContents
    Range("C3").Select
'For J = 2 To 5000
'If Sheet4.Cells(J, 2) = "" Then
 'H = J
'Exit For
'End If

'Next J
'Sheet4.Cells(H, 2) = Sheet2.Cells(3, 3)
'Sheet4.Cells(H, 3) = Sheet2.Cells(3, 5)
'Range("E3") = Range("E3").Value + 1

    Application.ScreenUpdating = True
End Sub

Sub SaveInformation()

For i = 5 To 100
If Sheet61.Cells(i, 2) = "" Then
 p = i
Exit For

End If

Next i

Application.ScreenUpdating = False
Sheet61.Cells(i, 1) = Sheet96.Cells(3, 3)
Sheet61.Cells(i, 2) = Sheet96.Cells(6, 3)
Sheet61.Cells(i, 3) = Sheet96.Cells(7, 3)
Sheet61.Cells(i, 4) = Sheet96.Cells(8, 3)
Sheet61.Cells(i, 5) = Sheet96.Cells(9, 3)
Sheet61.Cells(i, 6) = Sheet96.Cells(10, 3)
Sheet61.Cells(i, 7) = Sheet96.Cells(11, 3)
Sheet61.Cells(i, 8) = Sheet96.Cells(12, 3)
Sheet61.Cells(i, 9) = Sheet96.Cells(13, 3)
Sheet61.Cells(i, 10) = Sheet96.Cells(14, 3)
Sheet61.Cells(i, 11) = Sheet96.Cells(15, 3)
Sheet61.Cells(i, 12) = Sheet96.Cells(16, 3)
Sheet61.Cells(i, 13) = Sheet96.Cells(17, 3)
Sheet61.Cells(i, 14) = Sheet96.Cells(18, 3)
Sheet61.Cells(i, 15) = Sheet96.Cells(19, 3)
Sheet61.Cells(i, 16) = Sheet96.Cells(20, 3)
Sheet61.Cells(i, 17) = Sheet96.Cells(21, 3)
Sheet61.Cells(i, 18) = Sheet96.Cells(22, 3)

For j = 2 To 100
If Sheet62.Cells(j, 10) = "" Then
 H = j
Exit For

End If

Next j

Sheet62.Cells(j, 10) = Sheet61.Cells(5, 2)
Sheet62.Cells(j, 11) = Sheet61.Cells(5, 1)
Sheet62.Cells(j, 12) = Sheet96.Cells(5, 1)

MsgBox "gespeichert!"

Sheet96.Cells(3, 3) = Sheet96.Cells(3, 3) + 1
For i = 6 To 24
Sheet96.Cells(i, 3) = ""
Next i
Application.ScreenUpdating = True
End Sub

Esta macro es para ingresar los datos de los nuevos empleados (Arbeitnehmer) pero exactamente la misma macro la tenia en el otro libro para agregar los postulantes. El punto es que al unir los libros la macro para los pstulantes no me responde.

¿Se qué es un poco complicado de entender pero prodria alguien ayudarme?

Dante Amor crees que me puedas ayudar.

Respuesta
1

Envíame tu archivo que tiene el problema y me explicas qué debería realizar.

Mi correo [email protected]

En el asunto del correo escribe tu nombre de usuario “gilda montero” y el título de esta pregunta.

Ya te envíe el correo con el archivo en cuestión

Gracias por tu respuesta Dante. Eres mi angel.

Revisa el nombre de las hojas.

Cambia en la macro el nombre-Id de la hoja por el nombre de usuario de la hoja.

Por ejemplo, en la macro pusiste:

Sheet61.Cells(i, 1) = Sheet96. Cells(3, 3)

el nombre-Id de la hoja es Sheet61 y Sheet96

En el nuevo libro, tal vez, tienen otro nombre-Id, mejor pon el nombre de la hoja, por ejemplo:

Sheets("nombrehoja").Cells(i, 1) = sheets("elotronombre"). Cells(3, 3)

cambia "nombrehoja" y "elotronombre" por los nombres reales de la hojas

sal u dos

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas