Results 1 to 10 of 10

Help with the correct syntax on a Split function

Threaded View

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

    Help with the correct syntax on a Split function

    Hello all,

    I've made the following 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
        Next CodInd
        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 in the line with the split function, I get an error 1004 "Application defined or Object defined error"

    I'm not 100% sure what I'm missing but it's my first time using this particular function, any pointers would be appreciated.
    Thanks!
    Last edited by FZappa; 08-30-2019 at 03:52 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] macro fails to allow function with correct syntax to be pasted in cell
    By registrant_ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-22-2015, 01:06 PM
  2. [SOLVED] Correct syntax for function to find average based on background color of cells in range
    By moosetales in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-21-2014, 12:24 AM
  3. [SOLVED] Trying to find the correct syntax for a lookup function
    By freebird76 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-06-2013, 08:40 AM
  4. correct syntax for count function
    By penfold1992 in forum Excel General
    Replies: 2
    Last Post: 04-10-2012, 05:18 PM
  5. Help getting my syntax correct
    By MMS6300 in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 02-20-2009, 02:26 PM
  6. Correct VBA syntax for cell function formula
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-15-2005, 01:05 AM
  7. [SOLVED] If...and... - can never get the syntax correct!
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-24-2005, 01:06 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