C
Cindy Mikeworth
I have attempted to create a column insertion macro that dynamically copies
a static value of 'Active' into all the rows in the range. To this end,
during recording, I move to the column to the left and use an END-DOWN.
However, when I replay the macro, it copies the values to the static number
of rows that existed during the recording rather than the number of rows in
the current sheet.
My macro is below. I can see where it references cell B85. Can anyone help
me with how to get this to work?
Sub InsertStatusReason()
'
' InsertStatusReason Macro
' Macro recorded 09/25/2006 by cindy
'
'
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("A1").Select
Selection.End(xlDown).Select
Range("B85").Select
ActiveCell.FormulaR1C1 = "Active"
Range("B85").Select
Selection.Copy
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.End(xlUp).Select
ActiveCell.FormulaR1C1 = "STATUS REASON"
Range("B2").Select
End Sub
a static value of 'Active' into all the rows in the range. To this end,
during recording, I move to the column to the left and use an END-DOWN.
However, when I replay the macro, it copies the values to the static number
of rows that existed during the recording rather than the number of rows in
the current sheet.
My macro is below. I can see where it references cell B85. Can anyone help
me with how to get this to work?
Sub InsertStatusReason()
'
' InsertStatusReason Macro
' Macro recorded 09/25/2006 by cindy
'
'
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("A1").Select
Selection.End(xlDown).Select
Range("B85").Select
ActiveCell.FormulaR1C1 = "Active"
Range("B85").Select
Selection.Copy
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.End(xlUp).Select
ActiveCell.FormulaR1C1 = "STATUS REASON"
Range("B2").Select
End Sub