+ Reply to Thread
Results 1 to 14 of 14

i am getting an Syntax error

  1. #1
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    i am getting an Syntax error

    i am trying to specify the column Names which is to be locked

    Please Login or Register  to view this content.

  2. #2
    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
    48,994

    Re: i am getting an Syntax error

    Looks like IntersectColumnRows is a subroutine or function. Do you have the code for IntersectColumnRows?

    If not, that's likely to be your problem.

    Regards, TMS
    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


  3. #3
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: i am getting an Syntax error

    yes



    Please Login or Register  to view this content.

  4. #4
    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
    48,994

    Re: i am getting an Syntax error

    Ok, try it with the parameters in brackets

    Please Login or Register  to view this content.

    Regards, TMS

  5. #5
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: i am getting an Syntax error

    now i am getting another errror called

    Argument not optional

    Please Login or Register  to view this content.
    Last edited by baig123; 01-03-2015 at 05:14 AM. Reason: paragraph

  6. #6
    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
    48,994

    Re: i am getting an Syntax error

    Seems fair enough. The subroutine expects three ranges as well as the other parameters.

    Regards, TMS

  7. #7
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: i am getting an Syntax error

    i used to give like this

    Please Login or Register  to view this content.

  8. #8
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: i am getting an Syntax error

    In post #7, you have specified 9 parameter to the function which actually can take up to only 7 according to #
    Try reconsidering this with Brackets as Sir TMS has suggested.
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: i am getting an Syntax error

    Hi, Vikas,

    2 parameters for the column names are expected, and none of the threee ranges are delivered from baig123 when passing parameters. Please explain how any routine should work with brackets as I wonder how that could be.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  10. #10
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: i am getting an Syntax error

    without using IntersectColumnRows function can i used just sub

  11. #11
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: i am getting an Syntax error

    Sorry Holger,
    I didn't understand your question as my english is not that good as yours.
    As far as the brackets are concerned, (I don't know much of programming vocabulary)
    but practically, using x = Mysum Arg1, Arg2 give error but x = mysum (Arg1, Arg2) doesn't.
    If you know anything else then please share so that we can learn more of it.

  12. #12
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: i am getting an Syntax error

    Hi, Bikas,

    baig is using some code found anywhere on the net (to be more specific at stackoverflow) which should be the solution to the problem.

    The variable response is used for holding the return of a value of the sub procedure - but which one as no parameter is used for exchange if Iīm reading the code correctly. Normally this would be done to capture the return value from a function but no function and no return value here. As Trevor pointed out the parameters in this particular case should be provided within brackets, and all of them at the proper places or with the proper responding). Sadly baig choose to have his own way of filling the parameters and realizing that it wonīt work not worry about his failure but ask for help without providing the essential Sub.

    Counting the number of parameters may be one way to guess that the information between the calling sub and the one information is being passed to isnīt correct, looking at the parameters and finding only strings where 3 Ranges are due to be passed would be a better ides.

    Last: who says that baig has a table in the sheet? Thatīs what the code is assuming, and I have to assume this as well as somebody who doesnīt know what parameters need to be passed has picked this code for him to work.

    Ciao,
    Holger

  13. #13
    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
    48,994

    Re: i am getting an Syntax error

    HaHoBe: I think you are right. It is a subroutine, not a function. It would need to be a function to return a value.

    I've just been stepping through the issues. Is there code for the routine being called? Yes. If you are passing a result to a variable, the parameters need to be within brackets. Different error: give the routine all the parameters it is expecting.

    I must admit to not looking that far ahead. Bit early in the year, maybe? A quick glance at the code told me I didn't know what it was doing so I didn't spend a lot of time on it. Maybe missed the obvious.

    Regards, TMS

  14. #14
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: i am getting an Syntax error

    hi Holger,
    Thanks for the nice explanation.
    That Sub vs Function thing taught a lesson.
    Yes, I just counted the Parameters, and didn't consider their type.

    Thanks again.

+ 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. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  2. [SOLVED] first timer using VB to cut and paste macro - getting compile error syntax error
    By jopedder in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-2013, 11:45 AM
  3. Receiving following error “Complie error : syntax error” Help
    By masond3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2012, 10:19 AM
  4. [SOLVED] Compile Error: Expected Expression, Syntax Error
    By gjohn282 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2012, 11:28 PM
  5. Syntax Error and Compile Error: Expected Line Number or Label...
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-31-2011, 09:59 AM

Tags for this Thread

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