+ Reply to Thread
Results 1 to 14 of 14

Compile error: Argument not optional

  1. #1
    Registered User
    Join Date
    05-22-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    17

    Compile error: Argument not optional

    I want to start by saying I'm very new to macros so this may be a stupid question. I tried to run this macro here
    Please Login or Register  to view this content.
    But when I try to use it, I get the error: Compile error: Argument not optional

    I have attached the workbook I'm trying to do this in. The command I use is =VLOOKUPWORKBOOK1(A3, 'TS-5D1'!D3:D103, 4, 0) and is found on the Materials List tab in cell D3.

    Any help you could give would be great!

  2. #2
    Registered User
    Join Date
    05-23-2013
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Compile error: Argument not optional

    Not throwing any error for me except the fact that the line before "End Function" is "VLOOKUPWORKBOOK" when it should be "VLOOKUPWORKBOOK1" to match the name of your function.

  3. #3
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Compile error: Argument not optional

    try
    Please Login or Register  to view this content.
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  4. #4
    Registered User
    Join Date
    05-22-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compile error: Argument not optional

    Now when I try this, it says please update TS-5D1. What does this mean and what should I do?

  5. #5
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Compile error: Argument not optional

    why are you specifying the worksheet in the 2nd parameter when you loop through the sheets anyway?

    Please Login or Register  to view this content.
    use it like:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-22-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compile error: Argument not optional

    Well I'm not getting an error but it is just returning a zero. I've attached the updated version here. Could you take a look and see if you can figure it out?
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Compile error: Argument not optional

    check this: materials3.xlsm
    please note that the worksheet where the formula is located on will be skipped, otherwise the value to look for would find itself.


    contains:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-22-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compile error: Argument not optional

    This is starting to look good! Any idea why it is returning the numbers under quantity instead of the item description for some of the entries?

  9. #9
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Compile error: Argument not optional

    Please Login or Register  to view this content.
    so the value in column2 is returned, most likely from 'Master List' as you do not have leading zeros in the code number in all the other sheets ^^

  10. #10
    Registered User
    Join Date
    05-22-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compile error: Argument not optional

    Well that was silly. So I removed 'Master List' and corrected a few of the numbers but it still isn't working. When I try to set a custom amount of zero's using the cell number format option, it simply doesn't respond. Also, I adjusted the column parameter to 4 and it is just returning #value!. I just wanted to add that I really appreciate your help thus far!

    I've attached the most recent copy.
    Attached Files Attached Files

  11. #11
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Compile error: Argument not optional

    Pay attention when you set the Range in the formula, you want the value from column 4 but you look in A3:A103 which is just one column.
    use:
    Please Login or Register  to view this content.
    and replace the function with the code from post #7: materials3.xlsm

  12. #12
    Registered User
    Join Date
    05-22-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compile error: Argument not optional

    I love you so much right now! I really appreciate you being so patient with me. One last question. Why is it that when I try to format the numbers under the 'code number' to all resemble the pattern of xxxx-xx-xx it just doesn't respond? I would like it so they all have the leading zeros so that they fit that xxxx-xx-xx pattern.

  13. #13
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Compile error: Argument not optional

    For this your codes need to be numbers, e.g. '6330624' with custom format '0000-00-00' will be displayed as '0633-06-24'

  14. #14
    Registered User
    Join Date
    05-22-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Compile error: Argument not optional

    Well then I think I'm all set! I just want to thank you again for all your help! You are amazing!!!

+ 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