+ Reply to Thread
Results 1 to 3 of 3

Loop macro until empty row

Hybrid View

philprya Loop macro until empty row 07-17-2012, 10:51 PM
rylo Re: Loop macro until empty row 07-17-2012, 11:30 PM
philprya Re: Loop macro until empty row 07-17-2012, 11:57 PM
  1. #1
    Registered User
    Join Date
    07-17-2012
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2007
    Posts
    2

    Loop macro until empty row

    Hello!
    I have begun a macro that cuts data from the first cell in even numbered rows(beginning on row four), and pastes it into a new column on the end. I would like to be able to loop this process until two consecutive empty rows.
    I am new to this, and would be very thankful for helpful suggestions!


    Sub CommentMove()
    
    '
    ' CommentMove Macro
    '
    '    Move Comments to Column T one row up
    '
       
     Range("T1").Select
        ActiveCell.FormulaR1C1 = "Comments"
        Range("A4").Select
        Selection.Cut
        ActiveCell.Offset(-1, 19).Select
        ActiveSheet.Paste
        ActiveCell.Offset(3, -19).Select
        Selection.Cut
        ActiveCell.Offset(-1, 19).Select
        ActiveSheet.Paste
        ActiveCell.Offset(3, -19).Select
      
    End Sub
    Last edited by philprya; 07-17-2012 at 11:21 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Loop macro until empty row

    Hi

    Here goes

    Range("T1").Value = "Comments"
      For i = 4 To Cells(Rows.Count, 1).End(xlUp).Row Step 2
        Cells(i - 1, 20).Value = Cells(i, 1).Value
        Cells(i, 1).ClearContents
      Next i
    rylo

  3. #3
    Registered User
    Join Date
    07-17-2012
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Loop macro until empty row

    Fantastic! Thank you very much for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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