+ Reply to Thread
Results 1 to 4 of 4

Looking for a 'Do Until' script.....

  1. #1
    Registered User
    Join Date
    07-22-2013
    Location
    Portland, Maine
    MS-Off Ver
    MS Office 2013
    Posts
    3

    Looking for a 'Do Until' script.....

    Hi All,
    I am pretty new to VBA's and need some help on a simple 'Do Until' Loop.
    I need a macro that will use relative cell references to transpose 2 columns of data into one row. I need it to end when the next row (in the columns) is empty because the data sets are anywhere from 20-300 rows. It needs to be relative because each time I input new data it must be on the row below the previous. This is what I have so far. It does what it should for the first line, but wont move through subsequent lines.

    Sub TRYOUT()
    'Dim n As Integer
    n = 1

    ' TRYOUT Macro
    '

    '
    Do Until IsEmpty(ActiveCell)
    ActiveCell.Offset(n, 0).Range("A1:B1").Select
    Selection.Cut Destination:=ActiveCell.Offset(-n, 2 * n).Range("A1:B1")
    n = n + 1
    Loop
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Looking for a 'Do Until' script.....

    Andrew,
    Welcome to the forum!
    Please use code tags with your code as per forum's rule.
    Avoid Do until/while loops if you can, instead use for next
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-22-2013
    Location
    Portland, Maine
    MS-Off Ver
    MS Office 2013
    Posts
    3

    Re: Looking for a 'Do Until' script.....

    Hmmm, For some reason that didnt seem to do anything on my system.

  4. #4
    Registered User
    Join Date
    07-22-2013
    Location
    Portland, Maine
    MS-Off Ver
    MS Office 2013
    Posts
    3

    Re: Looking for a 'Do Until' script.....

    So....I figured it out in case anyone cares. the code is as follows
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Integrating Mainframe emulator script with excel's vba script
    By Himanshu Mishra in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2012, 10:30 AM
  2. Create VBA script to short, dedicated button in excel for script?
    By realized in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2009, 11:54 PM
  3. Script that edits the text printed on the button that runs the script
    By petalred in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2008, 02:41 PM
  4. VB script help..please !!
    By Anthony in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2005, 11:05 PM
  5. [SOLVED] VB Script
    By Steph in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-01-2005, 12:05 PM

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