The following macro is my crude solution (I sense there may be a much
more efficient way to do this) to a need in a multi-line file to insert
99 copies of each line between the existing lines; so a 10 line file
becomes a 1000 line file, etc. The macro works on the 1000 line
example, but when I tried it on a 20,000 line test file I got an error
that the 'clipboard cannot be emptied', debug revealed it was on the
line with stars below that the error was occuring. How do I deal with
that? Or, alternatively, is there a much better way to achieve the same
results?
Thanks in advance,
Rob
Sub Interpolate_NIRS()
numlines = Range("A1").SpecialCells(xlCellTypeLastCell).Row
MsgBox numlines
Application.ScreenUpdating = False
For j = 1 To numlines
ActiveCell.Rows("1:1").EntireRow.Select
Selection.Copy
For k = 1 To 99
ActiveCell.Range("A1:B1").Select
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.Insert Shift:=xlDown
**** Next
ActiveCell.Offset(1, 0).Range("A1").Select
Next
Application.ScreenUpdating = True
numlines = Range("A1").SpecialCells(xlCellTypeLastCell).Row
MsgBox numlines
End Sub
--
rroach
------------------------------------------------------------------------
rroach's Profile:
http://www.excelforum.com/member.php...o&userid=21093
View this thread:
http://www.excelforum.com/showthread...hreadid=380048