On 12/24/2020 11:59 AM, Bruno Campanini wrote:
> Public Sub AddingDups()
> Dim n As Integer, i As Integer, j As Integer
>
> n = 3 ' How many duplicates to add
> For j = 1 To n
> Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
> For i = 1 To Selection.Columns.Count
> Selection(1, i) = Selection(2, i)
> Next
> Next
>
> End Sub
Well, kinda' close, but not quite right. :)
There's a formula "=ROW()" in one column--I need that for some other
external processing that do on the file. This ends up copying the value
of the existing row the three times instead of duplicating the formula
in the new rows.
Also, not sure how acts on your machine but it takes some considerable
time before it finishes and repaints the screen. It's not a huge
workbook, this one is now about 500 rows with about 30 columns.
Anything magic that can call to turn of updating or the like that might
make it be faster? It's slow enough now would probably just continue
the manual duplication.
I dunno, is it possible to insert the N blank rows and then copy to them
would be quicker? I'm no VBA whiz, just guessing.
I didn't try, I presume one could call Application.InputBox to get the
value for N.
Thanks for the feedback...
--