Results 1 to 4 of 4

VBA tells me I have a Loop without a Do, but I'm not sure where the problem lies.

Threaded View

  1. #1
    Registered User
    Join Date
    12-27-2018
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2013, 2016
    Posts
    25

    VBA tells me I have a Loop without a Do, but I'm not sure where the problem lies.

    Hi all, simple question, I believe. I've written this macro

    
    Function BuscarFila(Codigo As String, Rango As Range)
    
    Dim FilaCorriente As Integer
    Dim NoDeFilas As Integer
    Dim FilaEquivalente As Integer
    Dim Cods As Variant
    Dim CodInd As Variant
    
    FilaEquivalente = 0
    FilaCorriente = 1
    
    Do
        Cods = Split(Rango.Cells(FilaEquivalente, 1), ", ")
        For Each CodInd In Cods
        If CodInd.Value = Codigo Then
            FilaEquivalente = FilaCorriente
        End If
        FilaCorriente = FilaCorriente + 1
        Debug.Print CodInd
    Loop Until ((FilaCorriente = NoDeFilas) Or (FilaEquivalente <> 0))
    
    If FilaEquivalente <> 0 Then
        MsgBox (Rango.Cells(FilaEquivalente, 1).Value)
    End If
    
    End Function
    And I keep getting the same error: "Loop without Do"

    So I'm assuming that something inside that Do is closing it but I don't know enough about VBA to know what that could be. Could somebody illuminate that for me?

    Thank you very much in advance.
    Last edited by FZappa; 08-30-2019 at 02:41 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need a VBA func. that tells if a point lies above/below 3D polygon surface
    By gonurvia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-29-2017, 10:41 AM
  2. [SOLVED] True or False if Number Lies Between a Certain Value
    By AtomicDog in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-10-2014, 11:03 AM
  3. Replies: 4
    Last Post: 03-24-2013, 11:15 AM
  4. Replies: 4
    Last Post: 12-14-2011, 03:08 PM
  5. When Cell Value lies between two values?
    By Stirly in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-09-2006, 06:18 AM
  6. Finding the cell in which an object lies
    By F*SH in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-19-2006, 04:33 AM
  7. Cell lies within range
    By Kaval in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2005, 08:05 AM

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