Dear All,

I have a simple macro below :

Sub Macro2()

ActiveCell.Offset(-5, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "TASK"
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[-3],""-"",RC[-2])"
Selection.AutoFill Destination:=ActiveCell.Range("A1:A5")

End Sub

Above code does following :

- go to col-d , types TASK
- perform concat on col-a, col-b text and returns value
- it works fine as long as i have 5 records, where is there increase in no of records it gives error.

How to give the cell range based on no records present in data

regards,
jsimha