+ Reply to Thread
Results 1 to 10 of 10

Help with the correct syntax on a Split function

  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:

    Please Login or Register  to view this content.
    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.

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Help with the correct syntax on a Split function

    I think the issue is not the split function but the range where you have FilaEquivalente = 0 then you used it in cells(0,1)

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

    Re: Help with the correct syntax on a Split function

    Thank you, that certainly moved it forward. However, now for the line

    Please Login or Register  to view this content.
    Gives me an "object required" error.

    Any idea how to reconcile the object with the string? Essentially I'm trying to separate any values in said range that are separated by commas and then seeing if one of those values match the one we're searching for with the function. I suppose CodInd.Value isn't the right way to write it, but I really have no idea how to do it in that case.

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Help with the correct syntax on a Split function

    How about this

    Please Login or Register  to view this content.

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

    Re: Help with the correct syntax on a Split function

    It gives me a type mismatch now. Would that solution go through multiple values if they're found in the same cell in any case?

  6. #6
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Help with the correct syntax on a Split function

    I am not really able to understand your function. If you could answer my below question I might be able to rewrite it or amend it … So in the function you will select let say cell A1 which is a string [for example the world Plane] and then select range("B1:B10") which also hold strings but in some cells have multiple words separated by a comma. And the world Plane appears in cell B3, what is the expected output of the function ? A message box ?

  7. #7
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: Help with the correct syntax on a Split function

    If you could attach a small workbook with a sample & expected results would be much easier I guess than explaining

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Help with the correct syntax on a Split function

    CodInd is variant and is element of Cods array.
    To compare value of element...
    Please Login or Register  to view this content.
    You can test this by doing...
    Please Login or Register  to view this content.
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

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

    Re: Help with the correct syntax on a Split function

    Okay, I was over-complicating it then, thank you very much.

  10. #10
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,000

    Re: Help with the correct syntax on a Split function

    FilaEquivalente = 0

    Cods = Split(Rango.Cells(FilaEquivalente, 1), ", ")

    There is no row zero in Excel; therefore, error 1004
    Ben Van Johnson

+ 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] 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. 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