I have a large (2,500 row) sheet in which I need to insert a considerable number of blank rows, then copy the contents of the row above into this. I select the rows I need to perform this operation on using an IF statement which inserts the word 'both' into a cell if a condition is met. I then filter the column which contains this cell so I end up with a filtered list of between 2 and 300 rows. Currently I use a short macro:
Sub InsertCopyRow()
ActiveCell.Offset(1, 0).EntireRow.Insert
ActiveCell.EntireRow.Copy ActiveCell.Offset(1, 0).EntireRow
End Sub
to perform this operation, but I have to run the macro manually on each selected row, which is quite time consuming.
Is there a way of automating it so that the macro will run on every row where the target cell contains the word 'both', as in:
=IF(H1="both","run macro 'InsertCopyRow'","") ?
2007-11-10
00:25:41
·
3 answers
·
asked by
Midas
2
in
Computers & Internet
➔ Programming & Design