Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Recursion with user defined functions

My problem, is that Excel (I am using excel 2003) seems
to reenter the user function, but never completes the
first call and gets confused. (I get very confuded).

I would appreciate any assistence.


I want the user to select from a list box, and for the
response to feed a few cells.

eg. List Box =
"7 table Mitchell",
"8 table Mitchell",
"6 table Howell"
etc.

I have formulas on the two target cells as follows :-
Cell NoTables = UserFunction("NoTables") ' 7, 8, 6
Cell NoBoards = UserFunction("NoBoards") ' 24, 32

I have the following user function :-

Public Function UserFunction (cString As String) As
Integer

Dim iNoBoards As Integer
Dim iNoTables As Integer

Dim cMovementName As String
cMovementName = Range("MovementName").Cells(1,
1).Value

Dim rFound As Range
Set rFound = Range("MovementNames").Find
(cMovementName, LookIn:=xlValues)
If Not rFound Is Nothing Then
' We found the value.
iNoBoards = rFound.Cells(0, 1).Value
iNoTables = rFound.Cells(0, 2).Value
Else
' Value not found.
iNoBoards = 24
iNoTables = 8
End If
Set rFound = Nothing

If (cString = "No Boards") Then UserFunction =
iNoBoards
If (cString = "No Tables") Then UserFunction =
iNoTables

End Function

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Recursion with user defined functions

There doesn't seem to be anything recursive about your function.

Perhaps the combination of functions you have in your worksheet are causing
the problem.

--
Regards,
Tom Ogilvy



"bigJim" wrote in message
...
My problem, is that Excel (I am using excel 2003) seems
to reenter the user function, but never completes the
first call and gets confused. (I get very confuded).

I would appreciate any assistence.


I want the user to select from a list box, and for the
response to feed a few cells.

eg. List Box =
"7 table Mitchell",
"8 table Mitchell",
"6 table Howell"
etc.

I have formulas on the two target cells as follows :-
Cell NoTables = UserFunction("NoTables") ' 7, 8, 6
Cell NoBoards = UserFunction("NoBoards") ' 24, 32

I have the following user function :-

Public Function UserFunction (cString As String) As
Integer

Dim iNoBoards As Integer
Dim iNoTables As Integer

Dim cMovementName As String
cMovementName = Range("MovementName").Cells(1,
1).Value

Dim rFound As Range
Set rFound = Range("MovementNames").Find
(cMovementName, LookIn:=xlValues)
If Not rFound Is Nothing Then
' We found the value.
iNoBoards = rFound.Cells(0, 1).Value
iNoTables = rFound.Cells(0, 2).Value
Else
' Value not found.
iNoBoards = 24
iNoTables = 8
End If
Set rFound = Nothing

If (cString = "No Boards") Then UserFunction =
iNoBoards
If (cString = "No Tables") Then UserFunction =
iNoTables

End Function



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User defined functions without using VBA. [email protected] Excel Discussion (Misc queries) 0 June 13th 06 05:50 PM
User Defined Functions Mike McLellan Excel Worksheet Functions 2 May 4th 06 10:56 AM
About User Defined Functions linzhang426 Excel Worksheet Functions 4 October 17th 05 09:27 PM
User Defined Functions Jeff B Excel Worksheet Functions 1 April 27th 05 09:59 PM
User Defined Functions Tom Waters Excel Programming 1 July 21st 03 12:00 PM


All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"