Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Double Up Data in Excel 2K 1

Status
Not open for further replies.

MeGustaXL

Technical User
Aug 6, 2003
1,055
GB
Hi There,

In XL2K, how can I take a table of numbers like this:
Code:
99.3
160.0
291.3
477.7
659.3
927.0

and with a wave of my wand, double up each row like this:

Code:
0
0
99.3
99.3
160.0
160.0
291.3
291.3
477.7
477.7
659.3
659.3
927.0
927.0

The table is dynamic, and could grow to several thousand rows.

Oh, I forgot to mention, I'd also like the spell to add a couple of zeroes at the top!

Everything I've tried so far turns to mush [cry]

Can you help?


Chris

Varium et mutabile semper Excel

 
Look at the FAQ area to get at least 2 ways to retrieve the last row number.
Then loop from bottom to top for the duplication.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
what have you tried so far ?

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Hi
Assuming your data is in column A and starts in row 1 then this should serve as a starting point at least

Code:
Sub a()
Dim lRow As Long
For lRow = 2 To [a65536].End(xlUp).Row * 2 Step 2
    Rows(lRow).EntireRow.Insert
    Cells(lRow, 1) = Cells(lRow - 1, 1)
Next
Rows("1:2").Insert
Range("A1:A2").Value = 0
End Sub

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
Cheez, You Guys are QUICK!

PHV - Thanks M8, just the steer I needed to get me started. [thumbsup]

Geoff - I'd tried the usual Numpty way of doing it manually while recording it - complete and utter, utter, UTTER failure!

LOOMAH - nice one Son! Just the job, and only 11 minutes after I asked the question! [2thumbsup] +*

Chris

Varium et mutabile semper Excel

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top