+ Reply to Thread
Results 1 to 8 of 8

Mac issue (please help) "Compile error: Expected Function or variable"

  1. #1
    Registered User
    Join Date
    09-14-2010
    Location
    Park City, UT
    MS-Off Ver
    2010
    Posts
    19

    Exclamation Mac issue (please help) "Compile error: Expected Function or variable"

    Hello,

    I created the code (below) on a PC and the file works great! Our company has started issuing macs to some users and one of the people who got one just ran one of my workbooks and got this error:

    "Compile error:
    Expected Function or variable"

    The error occurs at the first ".ClearContents". Since it is getting hung up there, I can only assume it might get hung up on the others.

    ANY HELP WOULD BE APPRECIATED!

    Here is the code:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Mac issue (please help) "Compile error: Expected Function or variable"

    I don't know what you're trying to do, but ClearContents is a method that clears a range.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    09-14-2010
    Location
    Park City, UT
    MS-Off Ver
    2010
    Posts
    19

    Re: Mac issue (please help) "Compile error: Expected Function or variable"

    Thanks, SHG - I understand that ClearContents is a method that clears a range. It is working great on a PC. I'm only having an issue on Macs with it using the code above.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Mac issue (please help) "Compile error: Expected Function or variable"

    It may work on a PC, but the syntax makes little sense. If you explain what you're trying to do, I'll try to help.

  5. #5
    Registered User
    Join Date
    09-22-2011
    Location
    Iowa
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Mac issue (please help) "Compile error: Expected Function or variable"

    Using Mac Excel 2011 - I have a list of over 7000 names. I want to group each name and get a total of the number of times each name occurs in the list. HELP!

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Mac issue (please help) "Compile error: Expected Function or variable"

    I meant, more narrowly, what is that line of code supposed to do. Try replacing it with this:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-14-2010
    Location
    Park City, UT
    MS-Off Ver
    2010
    Posts
    19

    Re: Mac issue (please help) "Compile error: Expected Function or variable"

    SHG:

    I've uploaded an empty version of the spreadsheet... check it out. I didn't know any VBA before doing it and am excited with what I did first time through.

    The spreadsheet I have is an elaborate budget tracker for multi-million dollar events we run. On one tab, the user selects which items they would like in their budget (barricades, jumbotrons, lighting, audio/video equipment, judges fees, etc. Once they select these items, they navigate to the second tab which is the active budget. Depending on what they selected on the first tab, these items will appear. This is beneficial to the people I work with because if they don't need item(s) in a budget, this spreadsheet hides them.

    To sum up what I am trying to achieve with the code at this point, here it is in laymen's terms:

    CHECK A HIDDEN CELL IN EACH ROW (OF A RANGE) TO SEE IF IT HAS A VALUE. IF IT HAS A VALUE ("1"), THEN IT WAS SELECTED ON THE FIRST TAB.
    For Each rngCellBeingChecked In Range("F5:F59,F62:F116,F119:F153,F156:F210,F213:F224")

    IN A HIDDEN CELL (NOT VISIBLE TO THE USER) ON EACH ROW, IF THE VALUE OF THAT CELL EQUALS "1", THEN IT WAS SELECTED ON THE FIRST TAB SO MAKE THE ROW VISIBLE ELSE
    If rngCellBeingChecked.Value = "1" Then
    rngCellBeingChecked.EntireRow.Hidden = False
    Else

    ELSE, THE ITEM IS NOT IN THE BUDGET SO HIDE THE INFO AND DELETE ANY VALUES IN CERTAIN CELLS.
    rngCellBeingChecked.EntireRow.Hidden = True And rngCellBeingChecked.Offset(0, -1).ClearContents = True And rngCellBeingChecked.Offset(0, 1).ClearContents = True And rngCellBeingChecked.Offset(0, 2).ClearContents = True And rngCellBeingChecked.Offset(0, 3).ClearContents = True And rngCellBeingChecked.Offset(0, 4).ClearContents = True

    I will try what you recommended and test it on a Mac. I'll let you know.
    Attached Files Attached Files
    Last edited by m1notaur; 09-22-2011 at 05:57 PM.

  8. #8
    Registered User
    Join Date
    09-14-2010
    Location
    Park City, UT
    MS-Off Ver
    2010
    Posts
    19

    Re: Mac issue (please help) "Compile error: Expected Function or variable"

    Quote Originally Posted by itsmeiniowa View Post
    Using Mac Excel 2011 - I have a list of over 7000 names. I want to group each name and get a total of the number of times each name occurs in the list. HELP!
    itsmeiniowa - Sorry, man... this is my string... if you got a problem, please create a new post so people can help out with your issue. Good luck.

+ 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