+ Reply to Thread
Results 1 to 6 of 6

Syntax error in code???

  1. #1
    Registered User
    Join Date
    12-05-2012
    Location
    victoria
    MS-Off Ver
    Excel 2010
    Posts
    55

    Syntax error in code???

    practice.xls

    Hello guys,

    I have a problem with the macro for sheet1 of the attached spreadsheet. When it performs the COUNTIF() it only returns the value of TRUE instead of the number. The while loops work as wanted but can anyone tell me what is wrong with the equation? I am assuming I am using a reference that isn't allow in this equation.

    The values in the worksheet are completely random, they are just there to see if it worked.

    Thanks,

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Syntax error in code???

    You have not attached a macro with your sheet (Not XLSM)

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Syntax error in code???

    AB33,

    Its an excel 2003 file so it does not need to have the .xlsm extension.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Syntax error in code???

    Is it the code called proTest?

    If it is the problem is because this is a logical expression.
    Please Login or Register  to view this content.
    It's testing if "=COUNTIF(Range(""D:D"")," is greater than " & Range(""Selection.Value""))"

    Try this instead.
    Please Login or Register  to view this content.
    Last edited by Norie; 12-06-2012 at 01:29 PM.
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    12-05-2012
    Location
    victoria
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Syntax error in code???

    Thanks a lot thats perfect. As I am new to the visual basic language can you tell me what the & does around the selection.value?? thanks

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Syntax error in code???

    & is the concatenation operator and is used to join strings.

    In this case it's being used to add Selection.Value into the fomula.

+ 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