+ Reply to Thread
Results 1 to 4 of 4

Do Until Loop

Hybrid View

  1. #1
    Registered User
    Join Date
    08-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Do Until Loop

    Hello All
    Being new to the forum as well as self taught in VBA was hoping for some insight
    I’m trying to Do a Loop in order for a formula [ROUND(J5*K5%,2)] to be inserted into column O is column A, J and K are filled. In addition to this, skip any space and stop when there more than 3 spaces or on the last row filled.

    Thus wondering if someone could point me in the right direction

    Sub Quota_Share()
    
    'Dim Last_Row As Long
    Application.ScreenUpdating = False
    
    'Last_Row = Sheets("Jul13").Range("A100").End(xlUp).Select
    
    Sheets("Jul13").Range("A5").Select
    
        Do
            'On Error Resume Next
            If ActiveCell.Offset(0, 0).Value <> "" Then
                If ActiveCell.Offset(0, 9).Value <> "" Then
                    If ActiveCell.Offset(0, 10).Value <> "" Then
                        ActiveCell.Offset(0, 14).FormulaR1C1 = "= ROUND(RC[-5]*RC[-4]%,2)"
                        ActiveCell.Offset(1, 0).Select
                    
                        Else
                        ActiveCell.Offset(1, 0).Select
                    End If
                End If
            End If
                  
        Loop Until IsEmpty(ActiveCell.Offset(0, 0)) And IsEmpty(ActiveCell.Offset(1, 0))
    Thanks in advance
    Last edited by Sagittariu5; 08-16-2013 at 10:20 AM.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Do Until Loop

    Maybe:

    Sub Sagittariu5()
    
    Application.ScreenUpdating = False
    
    Sheets("Jul13").Range("A5").Select
    
        Do
            If ActiveCell.Value <> "" And ActiveCell.Offset(0, 9).Value <> "" And ActiveCell.Offset(0, 10).Value <> "" Then
                        ActiveCell.Offset(0, 14).FormulaR1C1 = "= ROUND(RC[-5]*RC[-4]%,2)"
                        ActiveCell.Offset(1, 0).Select
            End If
                  
        Loop Until ActiveCell.Value = "" And ActiveCell.Offset(2).Value = ""
    
    Application.ScreenUpdating = True
    End Sub

  3. #3
    Registered User
    Join Date
    08-16-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Do Until Loop

    Hello John H. Davis
    That seems to do the trick

    Thanks very much for you help and insight, GREATLY appreciate it

    Regards
    Sagittariu5

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Do Until Loop

    You're welcome. Glad to help out and thanks for the feedback and the rep. Please comply with Forum Rule No. 9.

    9. Acknowledge the responses you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Dropdown option or Edit button will not appear -- ask a moderator to mark it.

+ 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. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  2. Why did an inner loop variable start overwriting the outer loop range suddenly?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2012, 03:24 PM
  3. Macro Loop Broken. Detects Max but doesn't continue loop
    By herchenbach in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2011, 12:17 PM
  4. Replies: 0
    Last Post: 07-20-2010, 11:42 AM
  5. Loop a column on Sheet1 and loop a row on Sheet2 to find a match
    By johnnywinter in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-13-2009, 02:09 PM

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