+ Reply to Thread
Results 1 to 5 of 5

Syntax error in this program

  1. #1
    Registered User
    Join Date
    10-28-2011
    Location
    UK
    MS-Off Ver
    Excel 2010 (mac)
    Posts
    10

    Syntax error in this program

    Please Login or Register  to view this content.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Syntax error in this program

    kathhying,

    You named a variable "name". Name is a built-in method in VBA used to rename a disk file, directory, or folder. So the variable "name" was getting confused with the VBA method Name. Change the variable "name" to "nam" or "nm" and you'll be fine
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    08-25-2011
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Syntax error in this program

    Put "Option Explicit" at the top of your code and work with some of your variable names. I see the name array (which my excel didn't like for some reason), but I also see a Names array, Occur array, Numcust,

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Syntax error in this program

    Hi kathhying

    What error message are you getting and at what line of code. I see
    Please Login or Register  to view this content.
    and then I see
    Please Login or Register  to view this content.
    which says
    Please Login or Register  to view this content.
    ???????
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Syntax error in this program

    As a statement of fact, your thread title is pretty accurate.

    It probably would have been helpful to have explained where the problem was encountered.

    As tigeravatar pointed out, name is a reserved word.

    But, as jstephens has pointed out, there are one or two more errors in the code. Your naming is inconsistent and you use variables that you haven't defined. Option explicit will help you to identify them.

    The code below runs but the Occurs variable needs to be defined and calculated.

    Please Login or Register  to view this content.

    Note that if you just press enter at the first InputBox, you'll get a blank MsgBox output.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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