B
Brad
Thanks for taking the time to read my question.
I'd like to loop through my variables. My variable names are F1, F2, F3 and
so on.
How can I make a loop to check the value of each variable? I tried
Control() but I think that's only for forms. I can't remember, or find, what
it is for functions.
Thanks,
Code:
Function FindValue(F1 As Variant, Optional F2 As Variant, Optional F3 As
Variant, Optional F4 As Variant, Optional F5 As Variant, Optional F6 As
Variant, Optional F7 As Variant, Optional F8 As Variant, Optional F9 As
Variant, Optional F10 As Variant, Optional F11 As Variant, Optional F12 As
Variant, Optional F13 As Variant, Optional F14 As Variant, Optional F15 As
Variant, Optional F16 As Variant, Optional F17 As Variant, Optional F18 As
Variant) As Integer
Dim x As Integer
Debug.Print F & x
Do Until x = 18
If Not IsNull(F & x) Then
FindValue = F1
Control
Exit Do
End If
x = x + 1
Loop
End Function
Brad
I'd like to loop through my variables. My variable names are F1, F2, F3 and
so on.
How can I make a loop to check the value of each variable? I tried
Control() but I think that's only for forms. I can't remember, or find, what
it is for functions.
Thanks,
Code:
Function FindValue(F1 As Variant, Optional F2 As Variant, Optional F3 As
Variant, Optional F4 As Variant, Optional F5 As Variant, Optional F6 As
Variant, Optional F7 As Variant, Optional F8 As Variant, Optional F9 As
Variant, Optional F10 As Variant, Optional F11 As Variant, Optional F12 As
Variant, Optional F13 As Variant, Optional F14 As Variant, Optional F15 As
Variant, Optional F16 As Variant, Optional F17 As Variant, Optional F18 As
Variant) As Integer
Dim x As Integer
Debug.Print F & x
Do Until x = 18
If Not IsNull(F & x) Then
FindValue = F1
Control
Exit Do
End If
x = x + 1
Loop
End Function
Brad