hi Deepan,
i am not able to understand clearly your requirement.....
the above code which you have written will always insert row in E11 , as you said. And also it will always copy the data which is in the range E8 to Z8...
I hope even the copy range should get altered every time when u insert a row...
The following code will help to insert a row and then copy the entire previous row data.....remember to place the cursor below the previous row data which you want to copy.....
For Eg: if Row 8 has, some data. Place the cursor in Row 9 and run this macro. So that one row will be inserted and Row 8 data will be copied into the inserted new row.
Hope this helps u.
To copy entire previous row data......use the below code..
Sub copy( )
ActiveCell.EntireRow.Insert
ActiveCell.Offset(-1, 0).Range("A1").copy Destination:=ActiveCell.EntireRow
End Sub
To copy based on selected range....use this code....
This code will enable you to open a input box, where you can select the range and the same data will be copied down after inserting a row. So you can select the range of previous row and the macro will insert a row and copy the same data.....
Sub copy2()
Dim rng As range
Set rng = Application.InputBox(Prompt:="Enter the Range (Previous row range)", Type:=8)
If rng Is Nothing Then
MsgBox "NO RANGE SELECTED"
Else
rng.Activate
End If
ActiveCell.Offset(1, 0).range("A1").Select
ActiveCell.EntireRow.Insert
rng.copy Destination:=ActiveCell
End Sub
Attaching the sample file...