PDA

View Full Version : Add range of rows at the last row



maytey
07-27-2009, 04:06 AM
Need help to write a macro. I have a file which i need to send out to different users, where they are suppose to input the data and return to me. Some users may need more lines and hence i will need to go into the individual files to add in the rows accordingly.

Is there any way, where i can write a macro and allow the users to click on the button to add the rows accordingly?

I have attached the file (Test.xls) to illustrate my problem.
In my files i have create Item 1 - Item 38 for the users to input their data. But some of the users might require more lines than expected. Hence, i need to input similar rows after Item 38.

Any idea how can i do that?

Thanks!

Bob Phillips
07-27-2009, 04:58 AM
Sub AddRows()
Dim LastRow As Long

With Worksheets("Add Capex")

LastRow = .Cells(.Rows.Count, "G").End(xlUp).Row

.Rows(LastRow - 12).Resize(6).Copy
.Rows(LastRow - 6).Insert Shift:=xlDown
End With
End Sub

maytey
07-27-2009, 11:18 PM
Thanks!!!!!!!! the macro workd perfectly!! :)