+ Reply to Thread
Results 1 to 2 of 2

New question about exiting a loop!

  1. #1
    Registered User
    Join Date
    12-06-2007
    Posts
    24

    New question about exiting a loop!

    I have a loop!

    This loop gathers info from a database based on a user selected variable.

    I instruct the macro to go down the database line by line and pull out the info of the rows that match the user's selection.

    The loop does this and writes the info into a new worksheet.

    I however (At my boss's request) need to omit any row it found that have a 0$ value.

    So I need to, within the loop to end itself if it found a 0 value and skip tp the next row.

    How???

    Many thanks!

    Here's to code!

    PHP Code: 
    For FindLoop 2 To 7100
        Info 
    Workbooks("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop22).Value
        
    If Info FindInfo Then
        Workbooks
    ("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop44).Value "YES"
        
    Workbooks("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop44).Interior.ColorIndex 4
        RequestNumber 
    Workbooks("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop1).Value
        Title 
    Workbooks("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop3).Value
        SubmissionDate 
    Workbooks("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop9).Value
        ClientName 
    Workbooks("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop4).Value
        WordCount 
    Workbooks("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop18).Value
        RequestCost 
    Workbooks("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop34).Value
        
    'If RequestCost = 0 Then
        '
    goto Next FindLoop
        
    'End If
        CostCenterNumber = Workbooks("TRANSLATION 2007-2008 oct-2007.xls").Worksheets("DATA").Cells(FindLoop, 22).Value
        a = a + 1
        Workbooks("Programme de rapport.xls").Worksheets("Donner").Cells(a, 3).Value = RequestNumber
        Workbooks("Programme de rapport.xls").Worksheets("Donner").Cells(a, 4).Value = Title
        Workbooks("Programme de rapport.xls").Worksheets("Donner").Cells(a, 2).Value = SubmissionDate
        Workbooks("Programme de rapport.xls").Worksheets("Donner").Cells(a, 1).Value = ClientName
        Workbooks("Programme de rapport.xls").Worksheets("Donner").Cells(a, 5).Value = WordCount
        Workbooks("Programme de rapport.xls").Worksheets("Donner").Cells(a, 6).Value = RequestCost
        TotalCostCenterCost = TotalCostCenterCost + RequestCost
        
        End If 

  2. #2
    Registered User
    Join Date
    12-06-2007
    Posts
    24

    More to add!

    The three REM lines are were I need to cut out of the loop!

+ 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