Excel/Visual basic

Advertisement


Question
Hello and thank you for your time.

In a spreadsheet, I have bottom lines that need to be the same as the above line in pairs of two. Right now only the top line is filled. It is so that line 2 is filled and line 3 needs to be equal to 2. Line 4 is filled differently, and line 5 needs to be equal to 4. So in pairs of two, the bottom line needs to be filled with whatever is on the top line.

Copying and pasting, the macro looks like this:
Range("A2:D2").Select
   Selection.Copy
   Range("A3").Select
   ActiveSheet.Paste

What should I add so the whole sheet, down to line 1974 will be filled with whatever is above? How can I have excel repeat the procedure all the way down to line 1974?

Thank you again

Answer
If my understanding is correct, that you have row 2, 4, 6, 8, 10, ... filled and rows 3,5,7,9,11,... are empty and you want the odd #'d rows equal to the even ones, then no VBA is necessary. Select A2:D1975, then press F5, click "Special", click Blanks, then enter an equal sign, press the up-arrow, and then ctrl/enter and you're done.

If that's NOT what you have, then VBA is probably best, but to ensure I know what you have, send a sample wm to me first at bobumlas@hotmail.com, use subject of "AllExpertsQ" and I'll send you the right VBA.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Bob Umlas

Expertise

I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at http://www.thumbtack.com/ny/new-york/excel-training/

Experience

Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Publications
Excellence, The Expert, Microsoft

Education/Credentials
BA in math, Hofstra University, 1965

Awards and Honors
MVP
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2016 About.com. All rights reserved.