Ed wrote and asked about a simple macro: Do you have a macro that can add rows to a spreadsheet (at the bottom or at cell pointer), then copy from the previous row and insert the data in the new row. And, finally delete data in certain cells.
Here is a macro that will insert a row above the cellpointer and copy the contents of the prior row. Let's assume your data extends from A to T, and that you want to delete the contents of the new row's cells H, K, and M
I'll use the keyword ActiveCell to make the macro work in relation to the cell pointer.
Sub AddRowForEd() ActiveCell.EntireRow.Insert Cells(ActiveCell.Row - 1, 1).Resize(1, 20).Copy _ Destination:=Cells(ActiveCell.Row, 1) Cells(ActiveCell.Row, 8).Clear ' Column H Cells(ActiveCell.Row, 11).Clear ' Column K Cells(ActiveCell.Row, 13).Clear ' Column M End Sub
By Bill Jelen on 01-Nov-2001
MrExcel.com Consulting can be hired to implement this concept, or many other cool applications, with your data.
MrExcel.com provides examples of Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations.
|