La macro no guarda
Hola, esta macro funciona perfectamente si le saco la instrucción "Application.ActiveWorkbook.Sabe" también probé con "ActiveWorkbook.Sabe", lo que me sorprende es que en otras macros más complejas y extensas esa instrucción funciona bien.
Me aparece un cartel con "recursos insuficientes" y cuando lo cierro otro que dice "error 1004", te agradezco cualquier ayuda. Saludos
Sub Prueba2()
'
' Prueba2 Macro
'
Application.ScreenUpdating = False
i = 0
Workbooks("REFORMA 8 (Salteado)").Worksheets("Base de datos mejorada").Activate
ActiveSheet.Calculate
Range("A1:AFN1").Select
Selection.Copy
Windows("Libro1"). _
Activate
Sheets.Add After:=Sheets(Sheets.Count)
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll
Application.CutCopyMode = False
ActiveCell.Offset(1, 0).Activate
Workbooks("REFORMA 8 (Salteado)").Worksheets("Hoja26optimiz").Activate
Range("GCB59").Copy
Range("A41:GCK41").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Calculate
Range("A59:GCB59").Copy
ActiveCell.Offset(2, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range(ActiveCell, ActiveCell.Offset(13, 4812)).Select
Selection.Calculate
Repetir:
Range(Cells(ActiveSheet.Range("B54").Value, ActiveSheet.Range("B45").Value), Cells(ActiveSheet.Range("B54").Value, ActiveSheet.Range("B46").Value)).Select
Selection.Calculate
Selection.Copy
ActiveCell.Offset(-13, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range(Cells(ActiveSheet.Range("A44").Value, ActiveSheet.Range("B45").Value), Cells(ActiveSheet.Range("A56").Value, ActiveSheet.Range("B46").Value)).Select
Selection.Calculate
Range("A44:G55").Select
Selection.Calculate
If Range("B50") > 0 Then
i = i + 1
Range("E59").Value = i + 1
If Range("E59") = 10000000 Then
GoTo FIN
End If
Range(Cells(ActiveSheet.Range("A55").Value, ActiveSheet.Range("B49").Value), Cells(ActiveSheet.Range("A55").Value, ActiveSheet.Range("C49").Value)).Select
Selection.Copy
ActiveCell.Offset(-16, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range(ActiveCell.Offset(6, 0), Cells(ActiveSheet.Range("A50").Value, ActiveSheet.Range("C49").Value)).Select
Selection.Calculate
Range(ActiveCell.Offset(-4, 0), Cells(ActiveSheet.Range("A46").Value, ActiveSheet.Range("C49").Value)).Select
Selection.Calculate
If Range("JI59").Value = "FIN" Then
GoTo FIN
End If
If Range("B44") > Range("B59") Then
Range("A57:GW59").Select
Selection.Calculate
Range("A59:GCB59").Copy
Windows("Libro1"). _
Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveCell.Offset(1, 0).Activate
Application.ScreenUpdating = True
Application.ActiveWorkbook.Save
Application.ScreenUpdating = False
Workbooks("REFORMA 8 (Salteado)").Worksheets("Hoja26optimiz").Activate
End If
Range("A44:G55").Select
Selection.Calculate
GoTo Repetir
Else: GoTo Repetir
End If
ActiveCell.Offset(-16, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range(ActiveCell, ActiveCell.Offset(11, Range("C49").Value - Range("B49").Value)).Select
Selection.Calculate
Repetir2:
Range("A44:G56").Select
Selection.Calculate
If Range("C49") > 0 Then
GoTo Repetir
End If
If Range("B47") = 0 Then
Range(Cells(ActiveSheet.Range("A44").Value, ActiveSheet.Range("B45").Value), Cells(ActiveSheet.Range("A56").Value, ActiveSheet.Range("B46").Value)).Select
Selection.Calculate
Else
Range(Cells(ActiveSheet.Range("A44").Value, ActiveSheet.Range("B47").Value), Cells(ActiveSheet.Range("A56").Value, ActiveSheet.Range("B48").Value)).Select
Selection.Calculate
End If
GoTo Repetir2
FIN:
End Sub
Me aparece un cartel con "recursos insuficientes" y cuando lo cierro otro que dice "error 1004", te agradezco cualquier ayuda. Saludos
Sub Prueba2()
'
' Prueba2 Macro
'
Application.ScreenUpdating = False
i = 0
Workbooks("REFORMA 8 (Salteado)").Worksheets("Base de datos mejorada").Activate
ActiveSheet.Calculate
Range("A1:AFN1").Select
Selection.Copy
Windows("Libro1"). _
Activate
Sheets.Add After:=Sheets(Sheets.Count)
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll
Application.CutCopyMode = False
ActiveCell.Offset(1, 0).Activate
Workbooks("REFORMA 8 (Salteado)").Worksheets("Hoja26optimiz").Activate
Range("GCB59").Copy
Range("A41:GCK41").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Calculate
Range("A59:GCB59").Copy
ActiveCell.Offset(2, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range(ActiveCell, ActiveCell.Offset(13, 4812)).Select
Selection.Calculate
Repetir:
Range(Cells(ActiveSheet.Range("B54").Value, ActiveSheet.Range("B45").Value), Cells(ActiveSheet.Range("B54").Value, ActiveSheet.Range("B46").Value)).Select
Selection.Calculate
Selection.Copy
ActiveCell.Offset(-13, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range(Cells(ActiveSheet.Range("A44").Value, ActiveSheet.Range("B45").Value), Cells(ActiveSheet.Range("A56").Value, ActiveSheet.Range("B46").Value)).Select
Selection.Calculate
Range("A44:G55").Select
Selection.Calculate
If Range("B50") > 0 Then
i = i + 1
Range("E59").Value = i + 1
If Range("E59") = 10000000 Then
GoTo FIN
End If
Range(Cells(ActiveSheet.Range("A55").Value, ActiveSheet.Range("B49").Value), Cells(ActiveSheet.Range("A55").Value, ActiveSheet.Range("C49").Value)).Select
Selection.Copy
ActiveCell.Offset(-16, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range(ActiveCell.Offset(6, 0), Cells(ActiveSheet.Range("A50").Value, ActiveSheet.Range("C49").Value)).Select
Selection.Calculate
Range(ActiveCell.Offset(-4, 0), Cells(ActiveSheet.Range("A46").Value, ActiveSheet.Range("C49").Value)).Select
Selection.Calculate
If Range("JI59").Value = "FIN" Then
GoTo FIN
End If
If Range("B44") > Range("B59") Then
Range("A57:GW59").Select
Selection.Calculate
Range("A59:GCB59").Copy
Windows("Libro1"). _
Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveCell.Offset(1, 0).Activate
Application.ScreenUpdating = True
Application.ActiveWorkbook.Save
Application.ScreenUpdating = False
Workbooks("REFORMA 8 (Salteado)").Worksheets("Hoja26optimiz").Activate
End If
Range("A44:G55").Select
Selection.Calculate
GoTo Repetir
Else: GoTo Repetir
End If
ActiveCell.Offset(-16, 0).Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range(ActiveCell, ActiveCell.Offset(11, Range("C49").Value - Range("B49").Value)).Select
Selection.Calculate
Repetir2:
Range("A44:G56").Select
Selection.Calculate
If Range("C49") > 0 Then
GoTo Repetir
End If
If Range("B47") = 0 Then
Range(Cells(ActiveSheet.Range("A44").Value, ActiveSheet.Range("B45").Value), Cells(ActiveSheet.Range("A56").Value, ActiveSheet.Range("B46").Value)).Select
Selection.Calculate
Else
Range(Cells(ActiveSheet.Range("A44").Value, ActiveSheet.Range("B47").Value), Cells(ActiveSheet.Range("A56").Value, ActiveSheet.Range("B48").Value)).Select
Selection.Calculate
End If
GoTo Repetir2
FIN:
End Sub
1 Respuesta
Respuesta de cristianccb
1