ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set Function to False -Why?? (https://www.excelbanter.com/excel-programming/345477-set-function-false-why.html)

JDB[_2_]

Set Function to False -Why??
 
I inherited some VBA code sometime ago, but do not understand one part
of it

The function is declared, some variables are declared and then the
fucntion is set to false

What does this do and why would it be done?

Thanks

JDB
------------------------

Public Function XA_List_Variables_Results_Sheet() As Integer

Dim LoinGrade As String, LoinMinMax As String
Dim PackStyle As String
Dim C As Integer, R As Integer
Dim I As Integer, LstIndex As Integer

' List_Variables_Results_Sheet = False

Worksheets("Matrix-Sheet").Activate

Rangename = "Supply"
GoSub LoadSupplyVariables

'more code


End Function


JDB[_2_]

Set Function to False -Why??
 
Sorry should be
XA_ List_Variables_Results_Sheet = False


bpeltzer

Set Function to False -Why??
 
The value assigned to the function is the value returned by that function.
So this line effectively sets the default return value to false (0);
presumably under certain conditions the function would change it to true (-1).
--Bruce

"JDB" wrote:

I inherited some VBA code sometime ago, but do not understand one part
of it

The function is declared, some variables are declared and then the
fucntion is set to false

What does this do and why would it be done?

Thanks

JDB
------------------------

Public Function XA_List_Variables_Results_Sheet() As Integer

Dim LoinGrade As String, LoinMinMax As String
Dim PackStyle As String
Dim C As Integer, R As Integer
Dim I As Integer, LstIndex As Integer

' List_Variables_Results_Sheet = False

Worksheets("Matrix-Sheet").Activate

Rangename = "Supply"
GoSub LoadSupplyVariables

'more code


End Function




All times are GMT +1. The time now is 12:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com