+ Reply to Thread
Results 1 to 9 of 9

UDF and Excel 2011 for MAC

  1. #1
    Registered User
    Join Date
    07-23-2012
    Location
    canada
    MS-Off Ver
    excel 2011
    Posts
    3

    UDF and Excel 2011 for MAC

    I want to create a small function that give me the date x amount of days ago. The code I have works when it is copied into the workbook's module I am currently working on. However I need it to be available access many workbooks. When inserted into a personal workbook project module, it returns: "#NAME?". The function is visable in the built in function list. I assume it has something to do with how the personal workbook functions. I recorded a basic macro the enters the number 7 into a cell. I saved this into the personal workbook and it is accessible in any other excel document.

    Any Ideas?

    Please Login or Register  to view this content.
    Prgramming experience: Beginner
    Previous Languages: Java, Python, HTML
    Office 2011 14.2.3 for Apple MAC
    Visual Basic 14.2.3

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: UDF and Excel 2011 for MAC

    I got it to work. I wonder, do you have the cell where you used this function formatted as a date?

    On the other hand, if you are wanting to put 7 in one cell and get the date - 7 in another cell, you need:

    Please Login or Register  to view this content.

  3. #3
    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: UDF and Excel 2011 for MAC

    You can either ...

    Enter the function as =Personal.xlsm!daysless(number), or

    Open the VBE, and in the workbook of interest, do Tools > References and set a reference to the VBA project in Personal (which you should rename to something recognizable like projPersonal)
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: UDF and Excel 2011 for MAC

    is this just an exercise? =today()-7 would be easier
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Registered User
    Join Date
    07-23-2012
    Location
    canada
    MS-Off Ver
    excel 2011
    Posts
    3
    Is this just an exercise? =today()-7 would be easier
    it is an partially an exercise. I use sumif and averageif with today()-X quite a bit and I was hoping to simplify those expressions while learning Excel VBA.

    When I enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I get a the following message, "Cannot find personal.xlsm". Doing a spotlight search yields nothing either. The function's module is clearly under the Personal Macro Workbook project. A quick google on this file didn't yield much. Most of the data only deals with windows. Could the problem lie here?


    The purpose of the recorded macro to enter the number 7, was purely a test. It shows that a recorded macro works across workbooks, but not functions.

    Open the VBE, and in the workbook of interest, do Tools > References and set a reference to the VBA project in Personal (which you should rename to something recognizable like projPersonal)
    Adding the project as a reference does work. Is there a way to make this automatic across all workbooks?

  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: UDF and Excel 2011 for MAC

    Adding the project as a reference does work. Is there a way to make this automatic across all workbooks?
    Add a reference in Book.xlsx in your XLSTART folder.

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: UDF and Excel 2011 for MAC

    is your personal macro workbook called personal.xls or personal.xlsb perhaps? setting a reference should not be necessary unless you want to use the function in vba in other workbooks without using application.run.

  8. #8
    Registered User
    Join Date
    07-23-2012
    Location
    canada
    MS-Off Ver
    excel 2011
    Posts
    3

    Re: UDF and Excel 2011 for MAC

    s your personal macro workbook called personal.xls or personal.xlsb perhaps?
    I have no idea. I search both and come up blank. Did i need to create it? where are my recorded macros being stored?

    Add a reference in Book.xlsx in your XLSTART folder.
    This didn't work, what exactly and I referencing to what? also, I couldn't find the XLSTART file, however there was this file: /Applications/Microsoft Office 2011/Office/Startup/Excel
    IT was empty so i created a new workbook in that location.

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: UDF and Excel 2011 for MAC

    if you recorded it to the personal macro workbook then it would have been created for you if it did not already exist. it seems that in 2011 you need to use
    ='Personal macro workbook'!daysless(number)

+ 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