Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Calling a function from a subroutine loop

Here is a subroutine and function that I cannot work out or find help on.
I'm trying to call a function in a subrouting, and then have the function
calculated inside a loop for changing variable values. Any advice would be
appreciated. Dan

Public Function CR(Y, X, Z)
Y = X^Z
End Function

Sub CalcCR()

Call CR(Y, X, Z)
X = 2
Z = 3
alpha = 1

For i = 1 to 10
X = X + Y
Next i

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calling a function from a subroutine loop

Public Function CR(Y, X, Z)
Y = X^Z
CR = Y
End Function

Sub CalcCR()

X = 2
Z = 3
alpha = 1

For i = 1 to 10
results = CR(Y, X, Z)
msgbox "X=" & X & " Results: " & results
X = X + Y
Next i

End Sub

--
Regards,
Tom Ogilvy


"Dan" wrote in message
...
Here is a subroutine and function that I cannot work out or find help on.
I'm trying to call a function in a subrouting, and then have the function
calculated inside a loop for changing variable values. Any advice would

be
appreciated. Dan

Public Function CR(Y, X, Z)
Y = X^Z
End Function

Sub CalcCR()

Call CR(Y, X, Z)
X = 2
Z = 3
alpha = 1

For i = 1 to 10
X = X + Y
Next i

End Sub




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
calling a subroutine outside a spreadsheet dino Excel Programming 5 June 11th 04 06:14 PM
Function Calling Subroutine Curare Excel Programming 1 February 24th 04 07:11 PM
calling a macro from within a loop Rick[_12_] Excel Programming 1 July 30th 03 11:52 PM
calling a macro from within a loop Mike Hughes Excel Programming 0 July 30th 03 08:50 PM
Calling the Solver via a subroutine James[_8_] Excel Programming 1 July 10th 03 01:08 AM


All times are GMT +1. The time now is 10:01 AM.

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

About Us

"It's about Microsoft Excel"