Hello,

Sorry if my question is stupid
Is it possible to pass a variable from a sub procedure to a function?

Example:

Sub Populate_Translation()
Dim k As Integer
For i = 0 To UBound(array_cust)
k = 1
CustType1 = Range("H" & i + 2).Value
array_cust(i, 0) = IdSite(Range("M" & i + 2).Value)
CustType2 = Range("H" & i + 3).Value
If CustType2 = CustType1 Then
k = k + 1
End If
Next i


And function:

Function IdSite(site As String) As Integer
Dim s As String

site = Left(site, InStr(6, site, Separator, vbTextCompare))

If s = "Online" Then
IdSite = ""
Else
IdSite = k
End If

End Function



So, the question is how do I pass the k variable from procedure to function, so that the function IdSite would be calculated base on k value?


Thank you!!!