Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UDF, Type it or use Insert Function
Excel 2002, Win XP
I remember being told in the past that a UDF must be entered using the function wizard (Insert Function dialog box) and that typing the function into a cell would not work. I have 3 UDFs below. The 3rd one uses the first 2. During development, I was able to utilize either of the first 2 by typing them into a cell manually. The 3rd one, no. The 3rd one required the function wizard to make it work. What is the rule that allows the first 2 to work (by typing direct) and the 3rd one to require the function wizard. Thanks for your help as always. For your information, this has to do with the military 8 digit date format. Otto Function DateFrom8(j As Range) As Date DateFrom8 = DateSerial(Left(j, 4), Mid(j, 5, 2), Right(j, 2)) End Function Function DateTo8(i As Date) As String DateTo8 = Year(i) & _ IIf(Len(Month(i)) 1, Month(i), "0" & Month(i)) & _ IIf(Len(Day(i)) 1, Day(i), "0" & Day(i)) End Function Function IncDate(k As Range) As String Dim TheDate As Date TheDate = DateFrom8(k) 'The "5" in the following line is actually a calculated variable. 'The "5" is used here for development purposes only' TheDate = _ DateSerial(Year(TheDate), Month(TheDate) + 5, Day(TheDate)) IncDate = DateTo8(TheDate) End Function |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UDF, Type it or use Insert Function
who ever told you that was obviously wrong.
I entered all three by typing them in and had no problem. I rarely use the function wizard to enter anything. I have never found it was necessary. Regards, Tom Ogilvy "Otto Moehrbach" wrote in message ... Excel 2002, Win XP I remember being told in the past that a UDF must be entered using the function wizard (Insert Function dialog box) and that typing the function into a cell would not work. I have 3 UDFs below. The 3rd one uses the first 2. During development, I was able to utilize either of the first 2 by typing them into a cell manually. The 3rd one, no. The 3rd one required the function wizard to make it work. What is the rule that allows the first 2 to work (by typing direct) and the 3rd one to require the function wizard. Thanks for your help as always. For your information, this has to do with the military 8 digit date format. Otto Function DateFrom8(j As Range) As Date DateFrom8 = DateSerial(Left(j, 4), Mid(j, 5, 2), Right(j, 2)) End Function Function DateTo8(i As Date) As String DateTo8 = Year(i) & _ IIf(Len(Month(i)) 1, Month(i), "0" & Month(i)) & _ IIf(Len(Day(i)) 1, Day(i), "0" & Day(i)) End Function Function IncDate(k As Range) As String Dim TheDate As Date TheDate = DateFrom8(k) 'The "5" in the following line is actually a calculated variable. 'The "5" is used here for development purposes only' TheDate = _ DateSerial(Year(TheDate), Month(TheDate) + 5, Day(TheDate)) IncDate = DateTo8(TheDate) End Function |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UDF, Type it or use Insert Function
Mostly the difference is that the function wizard uses EVALUATE (I think) ro
evaluate each keystroke as it goes along. hth Charles ______________________ Decision Models The Excel Calculation Site www.DecisionModels.com "Tom Ogilvy" wrote in message ... who ever told you that was obviously wrong. I entered all three by typing them in and had no problem. I rarely use the function wizard to enter anything. I have never found it was necessary. Regards, Tom Ogilvy "Otto Moehrbach" wrote in message ... Excel 2002, Win XP I remember being told in the past that a UDF must be entered using the function wizard (Insert Function dialog box) and that typing the function into a cell would not work. I have 3 UDFs below. The 3rd one uses the first 2. During development, I was able to utilize either of the first 2 by typing them into a cell manually. The 3rd one, no. The 3rd one required the function wizard to make it work. What is the rule that allows the first 2 to work (by typing direct) and the 3rd one to require the function wizard. Thanks for your help as always. For your information, this has to do with the military 8 digit date format. Otto Function DateFrom8(j As Range) As Date DateFrom8 = DateSerial(Left(j, 4), Mid(j, 5, 2), Right(j, 2)) End Function Function DateTo8(i As Date) As String DateTo8 = Year(i) & _ IIf(Len(Month(i)) 1, Month(i), "0" & Month(i)) & _ IIf(Len(Day(i)) 1, Day(i), "0" & Day(i)) End Function Function IncDate(k As Range) As String Dim TheDate As Date TheDate = DateFrom8(k) 'The "5" in the following line is actually a calculated variable. 'The "5" is used here for development purposes only' TheDate = _ DateSerial(Year(TheDate), Month(TheDate) + 5, Day(TheDate)) IncDate = DateTo8(TheDate) End Function |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
UDF, Type it or use Insert Function
I believe one of the advantages of using the function wizard is that it will
put the name of the Workbook in front of the Function. This helps when calling a function in another workbook, or perhaps when the same function name exists in two different workbooks. For example, it saves typing when calling a function located in Personal.xls. =Personal.xls!YourFunction( ) -- Dana DeLouis Windows XP & Office XP = = = = = = = = = = = = = = = = = "Charles Williams" wrote in message ... Mostly the difference is that the function wizard uses EVALUATE (I think) ro evaluate each keystroke as it goes along. hth Charles ______________________ Decision Models The Excel Calculation Site www.DecisionModels.com "Tom Ogilvy" wrote in message ... who ever told you that was obviously wrong. I entered all three by typing them in and had no problem. I rarely use the function wizard to enter anything. I have never found it was necessary. Regards, Tom Ogilvy "Otto Moehrbach" wrote in message ... Excel 2002, Win XP I remember being told in the past that a UDF must be entered using the function wizard (Insert Function dialog box) and that typing the function into a cell would not work. I have 3 UDFs below. The 3rd one uses the first 2. During development, I was able to utilize either of the first 2 by typing them into a cell manually. The 3rd one, no. The 3rd one required the function wizard to make it work. What is the rule that allows the first 2 to work (by typing direct) and the 3rd one to require the function wizard. Thanks for your help as always. For your information, this has to do with the military 8 digit date format. Otto Function DateFrom8(j As Range) As Date DateFrom8 = DateSerial(Left(j, 4), Mid(j, 5, 2), Right(j, 2)) End Function Function DateTo8(i As Date) As String DateTo8 = Year(i) & _ IIf(Len(Month(i)) 1, Month(i), "0" & Month(i)) & _ IIf(Len(Day(i)) 1, Day(i), "0" & Day(i)) End Function Function IncDate(k As Range) As String Dim TheDate As Date TheDate = DateFrom8(k) 'The "5" in the following line is actually a calculated variable. 'The "5" is used here for development purposes only' TheDate = _ DateSerial(Year(TheDate), Month(TheDate) + 5, Day(TheDate)) IncDate = DateTo8(TheDate) End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF TYPE FUNCTION | Excel Worksheet Functions | |||
some type of IF function | Excel Worksheet Functions | |||
how to type in 1 workbook & automatically insert in another book? | Excel Worksheet Functions | |||
NVL type function | Excel Worksheet Functions | |||
Help with TYPE function | Excel Discussion (Misc queries) |