+ Reply to Thread
Results 1 to 8 of 8

Excel macro (compile error. syntax error.) error

  1. #1
    Registered User
    Join Date
    11-23-2013
    Location
    Iraq
    MS-Off Ver
    Excel 2010
    Posts
    4

    Excel macro (compile error. syntax error.) error

    Hi everyone, am new here and this is my first question,


    I have recorded a macro without any issues, but now when am trying to use the macro with the same data I get the (compile error. syntax error.) with the (IF and OR) formula.

    Iam not expert with VBA but I think because the code is a little long and its more than one row so that is happening.

    I have searched many places but I couldn't find the right answer for this specific error. I hope someone can help here........... thanks very much in advanced.

    Below is the code where am getting error


    Please Login or Register  to view this content.
    Last edited by salar_younis; 11-23-2013 at 04:11 AM. Reason: posting mistakes

  2. #2
    Registered User
    Join Date
    11-23-2013
    Location
    Iraq
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Excel macro (compile error. syntax error.) error

    Hi, Mr.Winon

    sorry for the mistakes in posting, I have fixed the code tags, please check it and tell me if there is something else wrong with the post.


    sorry to bother you and thanks for your reply.

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: Excel macro (compile error. syntax error.) error

    Hello salar_younis,

    Thank you for adhering to the Forum Rules, and my reminder to you, to do so.

    Please could you upload a sample Workbook, complete with your Code, for us to see how best we may be able to assist you?

    I do see a problem with the formula syntax in your Code, but we would need to compare it with what you have setup in the Workbook itself.

    Thank you,

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    20,784

    Re: Excel macro (compile error. syntax error.) error

    Perhaps.
    Please Login or Register  to view this content.
    Better upload a small sample wokbook clearly showing what you have and the result you want.

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,101

    Re: Excel macro (compile error. syntax error.) error

    @ jindon,

    Your reply;

    Please Login or Register  to view this content.
    Should it not be?:

    Please Login or Register  to view this content.
    Let us see the sample Workbook.

    Regards
    Last edited by Winon; 11-23-2013 at 06:56 PM.

  6. #6
    Registered User
    Join Date
    11-23-2013
    Location
    Iraq
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Excel macro (compile error. syntax error.) error

    Iam trying to use an IF and OR formula to filter and give a specific value only when the value in the cell is (Number of Results = 1) and it works fine when I use it, but when I record it and try it with the same data it give me this error, when I checked the recorded macro in the VBA there is a difference in the formula.

    Thanks everybody for your reply ...........

    The following formula is the formula that I wrote when I was recording

    =IF(OR(B20="(Number of results = 1)",B19="(Number of results = 1)",B18="(Number of results = 1)",B17="(Number of results = 1)",B16="(Number of results = 1)",B15="(Number of results = 1)",B14="(Number of results = 1)",B13="(Number of results = 1)",B12="(Number of results = 1)",B11="(Number of results = 1)",B10="(Number of results = 1)",B9="(Number of results = 1)",B8="(Number of results = 1)",B7="(Number of results = 1)",B6="(Number of results = 1)",B5="(Number of results = 1)",B4="(Number of results = 1)",B3="(Number of results = 1)",B2="(Number of results = 1)"),"True","F")

    and below is the recorded code by the VBA

    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    20,784

    Re: Excel macro (compile error. syntax error.) error

    What is "k at the end of the formula?
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-23-2013
    Location
    Iraq
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Excel macro (compile error. syntax error.) error

    I have used the below mentioned code and its working fine this time ................... thanks everybody for your help

    Please Login or Register  to view this content.

+ 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] 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
  2. Compile Error: Syntax Error
    By ndv in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-15-2013, 03:34 AM
  3. [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
  4. Compile error: Syntax error
    By ttik in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2011, 09:45 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

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