Hola!, buen día! Desearia que alguien me ayudara con un problema que tengo al ejecutar una macro en Excel.
Lo que deseo es ejecutar una macro desde un celda activa, no desde donde inicialmente programe la macro. El codigo es el siguiente.
[color=blue]Sub Macro1()
'
' Macro1 Macro
' lkjbugvy
'
' Acceso directo: CTRL+h
'
Range(ActiveCell).Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.UnMerge
Range("A1:E1").Select
Selection.Copy
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1:E1").Select
Application.CutCopyMode = False
Selection.Copy
Range("A2:E5").Select
ActiveSheet.Paste
Range("H7").Select
End Sub
[/color]
Tengo entendido que para ejecutar lo que deseo se debe escribir el comando
Activecell despues de Range, pero cuando hago eso no se puede ejecutar la macro ya que detecta un error.
Cabe destacar que el resto del codigo lo que hace es que selecciona un rango de celdas y las descombina para que asi los datos que esten en una celda se queden en una sola y no se combinen con otras.
Saludos, y espero su pronta respuesta.