+ Reply to Thread
Results 1 to 3 of 3

Doubble loop to copy and paste

  1. #1
    Snoopy
    Guest

    Doubble loop to copy and paste

    Hey guys

    My table goes like this:
    A B C D E F ........
    _________________________
    1 | 1 Title 1
    2 | 1 Subtitle a
    3 | 1 Subtitle b
    4 | 1 Subtitle c
    5 | 1 Title 2
    6 | 1 Subtitle d
    7 | 1 Subtitle e
    8 | 1 Title 2
    9 | 1 Subtitle f

    .... and so on.

    What I want the macro to do is this; for each value "1" in column A,
    copy the "Title n" in column E into column D in the following cells
    (until next "1" in column A) where value "1" appears in column B. Get
    it?

    The result should be something like this:
    A B C D E F ........
    __________________________
    1 | 1 Title 1
    2 | 1 Title 1 Subtitle a
    3 | 1 Title 1 Subtitle b
    4 | 1 Title 1 Subtitle c
    5 | 1 Title 2
    6 | 1 Title 2 Subtitle d
    7 | 1 Title 2 Subtitle e
    8 | 1 Title 3
    9 | 1 Title 3 Subtitle f
    .... and so on.

    Is there any kindly and helpful "EXCEL-alien" out in VBA-space that
    will give me some help on this?

    Regards
    Snoopy


  2. #2
    Max
    Guest

    Re: Doubble loop to copy and paste

    Perhaps try also a non array formulas approach ?

    Put in F1: =IF(A1="","",COUNT($A$1:A1))
    Copy F1 down to last row of data in col A

    Put in D1:
    =IF(INDEX(E:E,MATCH(COUNT($F$1:F1),F:F,0))=E1,"",
    INDEX(E:E,MATCH(COUNT($F$1:F1),F:F,0)))
    Copy D1 down to last row of data in col D

    Col D seems to return what's required ..
    --
    Max
    Singapore
    http://savefile.com/projects/236895
    xdemechanik
    ---
    "Snoopy" <[email protected]> wrote in message
    news:[email protected]...
    > Hey guys
    >
    > My table goes like this:
    > A B C D E F ........
    > _________________________
    > 1 | 1 Title 1
    > 2 | 1 Subtitle a
    > 3 | 1 Subtitle b
    > 4 | 1 Subtitle c
    > 5 | 1 Title 2
    > 6 | 1 Subtitle d
    > 7 | 1 Subtitle e
    > 8 | 1 Title 2
    > 9 | 1 Subtitle f
    >
    > ... and so on.
    >
    > What I want the macro to do is this; for each value "1" in column A,
    > copy the "Title n" in column E into column D in the following cells
    > (until next "1" in column A) where value "1" appears in column B. Get
    > it?
    >
    > The result should be something like this:
    > A B C D E F ........
    > __________________________
    > 1 | 1 Title 1
    > 2 | 1 Title 1 Subtitle a
    > 3 | 1 Title 1 Subtitle b
    > 4 | 1 Title 1 Subtitle c
    > 5 | 1 Title 2
    > 6 | 1 Title 2 Subtitle d
    > 7 | 1 Title 2 Subtitle e
    > 8 | 1 Title 3
    > 9 | 1 Title 3 Subtitle f
    > ... and so on.
    >
    > Is there any kindly and helpful "EXCEL-alien" out in VBA-space that
    > will give me some help on this?
    >
    > Regards
    > Snoopy
    >




  3. #3
    Max
    Guest

    Re: Doubble loop to copy and paste

    Typo, line:
    > Copy D1 down to last row of data in col D


    should read as:
    > Copy D1 down to last row of data in col E

    --
    Max
    Singapore
    http://savefile.com/projects/236895
    xdemechanik
    ---



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1