+ Reply to Thread
Results 1 to 5 of 5

String Creating Function

Hybrid View

  1. #1
    Registered User
    Join Date
    07-07-2006
    Posts
    26

    String Creating Function

    Hi

    I currently use this formula in my spreadsheet
    ="ED"&VLOOKUP(MONTH(N107),immcodes,2,FALSE)&RIGHT(YEAR(N107),1)

    "ED" would be my futhandle and N107 is my futdate
    immcodes is a named range of 2 column array that looks like this

    1 F
    2 G
    3 H
    4 J
    5 k
    6 M
    7 N
    8 Q
    9 U
    10 V
    11 X
    12 Z

    I have written the following function, but cant even get the first message box to appear...any ideas?

    Function mazfutcodeoffdate(futhandle, futdate As Date, lookuptable, colreturn)


    futmonthx = WorksheetFunction.Month(futdate)
    ans = MsgBox("test", vbOKCancel)




    futfullyear = WorksheetFunction.Year(futdate)
    futyear = WorksheetFunction.Right(futfullyear, 1)

    futmonthcode = WorksheetFunction.VLookup(futmonth, lookuptable, lcolreturn, False)



    mazfutcodeoffdate = futhandle & futmonthcode & futyear


    End Function
    Last edited by Nike6106; 03-10-2010 at 01:22 PM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: String Creating Function

    Quote Originally Posted by Nike6106 View Post
    I have written the following function, but cant even get the first message box to appear...any ideas?
    So what do you get in the cell where you are using this?
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    07-07-2006
    Posts
    26

    Re: String Creating Function

    I should get something like EDH2

    But the function is returning #VALUE

  4. #4
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: String Creating Function

    Hi,

    See attached sample UDF ...

    HTH
    Attached Files Attached Files

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: String Creating Function

    That implies an error in the UDF or in how you are calling it. Can you post a sample?

+ 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