Hi all,
I recorded a macro for a simple task. I create a formula to format a cell based on the values of three others. I then copy it down to the end of the range.
The recorder gave me:
Sub Macro2()
'
Columns("D
"
.Select
Selection.Insert Shift:=xlToRight
Range("D2"
.Select
ActiveCell.FormulaR1C1 = _
"=TEXT(RC[-3],""0000""
&TEXT(RC[-2],""0000""
&TEXT(RC[-1],""0000""
"
Range("D2"
.Select
Selection.AutoFill Destination:=Range("D2
5"
End Sub
However, there may be any number of rows - the range in the recorded macro is fixed. How can I modify this to allow for a variable number of rows?
Thanks,
Henio
I recorded a macro for a simple task. I create a formula to format a cell based on the values of three others. I then copy it down to the end of the range.
The recorder gave me:
Sub Macro2()
'
Columns("D
Selection.Insert Shift:=xlToRight
Range("D2"
ActiveCell.FormulaR1C1 = _
"=TEXT(RC[-3],""0000""
Range("D2"
Selection.AutoFill Destination:=Range("D2
End Sub
However, there may be any number of rows - the range in the recorded macro is fixed. How can I modify this to allow for a variable number of rows?
Thanks,
Henio