1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

[Excel] Copy And Paste Upper Cell To Lower Cell

Discussion in 'Business Applications' started by HowdeeDoodee, Aug 26, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. HowdeeDoodee

    HowdeeDoodee Thread Starter

    Joined:
    Aug 26, 2004
    Messages:
    614
    Using EXCEL, I have a need to copy the cell contents from upper cells in col. A down a few rows in col A. There are various changes in data in col A as you will see below. The periods in the following info are used as placeholders only. B1, A2, A3, A4, etc. are blank. I need a formula because I have 60,000 records in the spreadsheet. Thanks in advance.

    Here is how the data looks now.

    ....A.....B
    Apple.........
    ..........Fire
    ..........Ice
    ..........Snow
    Peach
    ..........Sleet
    ..........Rain
    ..........Fog

    Here is how I want the data to look

    ...A ...........B
    Apple
    Apple.......Fire
    Apple.......Ice
    Apple.......Snow
    Peach
    Peach.......Sleet
    Peach.......Rain
    Peach.......Fog
     
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,911
    With the workbook open press ALT + F11 to bring up the Visual Basic Editor. Once the VB editor opens, click INSERT --> MODULE and paste the code below into the blank module. Close the VB editor and select the first cell in column A containing your data you want to copy down. Click TOOLS --> MACRO --> MACROS and select the macro from the list and run it. This macro will copy all your data except for the last value in column A because without actually seeing your workbook, I have no way knowing which line to stop at. Therefore, the code will end when it reaches the last value in column A.
    Code:
    Public Sub CopyData()
    
    Do Until ActiveCell.Row = Cells(Rows.Count, "A").End(xlUp).Row
    
    ActiveCell.Copy
    ActiveCell.Offset(1, 0).Select
    
    Do Until ActiveCell.Value <> ""
    ActiveSheet.Paste
    ActiveCell.Offset(1, 0).Select
    Loop
    
    Loop
    
    End Sub
    
    
    Rollin
     
  3. HowdeeDoodee

    HowdeeDoodee Thread Starter

    Joined:
    Aug 26, 2004
    Messages:
    614
    Thank you.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/266571