![]() |
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 |
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 |
All times are GMT +1. The time now is 09:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com