Macro: "Se ha producido un error (1004) en tiempo de ejecución. Error definido por la aplicación del objeto"
Gusto en saludarles.
Mis conocimientos sobre macros son muy pocos, motivo por el cual acudo a ustedes para solicitar muy respetuosamente el apoyo de los expertos en la materia.
Realicé una macro con la grabadora habilitando la opción Usar referencias relativas, pero al ejecutarla me presenta el siguiente mensaje "Se ha producido un error (1004) en tiempo de ejecución. Error definido por la aplicación del objeto". A continuación la macro:
Sub Macro8()
ActiveCell.Offset(-11, -1).Range("A1:M1").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
ActiveCell.Offset(1, 12).Range("A1").Select
Selection.Copy
ActiveCell.Offset(-1, 0).Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(0, -12).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 2).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 2).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 2).Range("A1").Select
Selection.ClearContents
End Sub
Hice la prueba haciendo la macro deshabilitando el uso de referencias relativas y funciona perfecto, pero necesito que la macro funcione en cualquier celda que quiera ejecutarla. A continuación la macro;
Sub Macro7()
Range("A2:M2").Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Range("M3").Select
Selection.Copy
Range("M2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
Selection.ClearContents
Range("C2").Select
Selection.ClearContents
Range("D2").Select
Selection.ClearContents
Range("E2").Select
Selection.ClearContents
Range("F2").Select
Selection.ClearContents
Range("H2").Select
Selection.ClearContents
Range("J2").Select
Selection.ClearContents
End Sub
De antemano muy agradecida por la valiosa ayuda que puedan brindarme, y les comento que muy probablemente estaré muy activa solicitando su apoyo, ya que estoy desarrollando dos nuevos proyectos laborales que requieren el uso de Excel.