MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Adding rows


Posted by John on July 24, 2001 10:04 AM

I have an excel spreadsheet I am opening. How do I in a loop add data to the last row.

activesheet.????


Posted by Cory on July 24, 2001 11:11 AM

I'm not sure what you want to do with a loop on this one, but to add data to the cell following the end of data in a column, add this to a button on your sheet:

Private Sub CommandButton1_Click()
Range("A1").Select
Selection.End(xlDown).Offset(1, 0).Select
ActiveCell.Value = "New Data"
End Sub

Replace A1 with the first (top) cell of the column of data and "New Data" with whatever you want to add. If you want to incorporate this in a loop, note the line above containing "Offset" is used to select the first blank cell at the bottom of the column...

Cory

Posted by John on July 24, 2001 11:20 AM

Thanks,
John