+ Reply to Thread
Results 1 to 3 of 3

Loops and IFs

  1. #1
    Registered User
    Join Date
    05-23-2008
    Posts
    11

    Loops and IFs

    Hi,

    I'm wondering if someone can help me with a simple macro.

    I want a Macro to look in Cell C1, if it is NOT blank, then Select Cells A2 to B2 and insert cells and shift everything down. Then move down to C2. If C2 is Not blank, Select Cells A3 to B3 and insert cells and shift everything down then move down to C3. If C3 is blank then just move down to C4.

    And keep looping until the end of the column.

    Any assistance will be greatly appreciated.

  2. #2
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro 2003 / 2010
    Posts
    423

    Re: Loops and IFs

    Surely this won't work?

    If c1 >0 Then insert two rows this will move c2 to c3 and c3 to c4.

    Then you want to check c2 which you have moved to c3 by your previous action.

  3. #3
    Registered User
    Join Date
    05-23-2008
    Posts
    11

    Re: Loops and IFs

    No I actually have Data in Columns A and B.

    for example
    test1 test1 comment1
    test2 test2 comment1
    test3 test3 comment1
    test4 test4
    test5 test5 comment2

    so starting on the first, if c1 isn't empty...
    it becomes
    test1 test1 comment1
    _________ comment1
    test2 test2 comment1
    test3 test3
    test4 test4 comment2
    test5 test5

    And you loop it until say test2 and comment2 are aligned and so forth for the rest of the data. Inserting a row will push the comment lines down and I only need the data in A&B to move down.

+ 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