Create a Function that gives an Array as Result.

  • Thread starter Thread starter V.K.S.B.K
  • Start date Start date
V

V.K.S.B.K

Guest
Dear Friends,

I want to create a function with two Arguments (such as 'SunLongitude' as Double & 'MoonLongitude' as Double) that gives an Array (of Integer) as result. The function should do the following calculations;

Dim PhaseLongitude As Double
Dim PhaseStartLongitude, PhaseEndLongitude As Integer

If SunLongitude < MoonLongitude Then
PhaseLongitude = MoonLongitude - SunLongitude
If SunLongitude > MoonLongitude Then
PhaseLongitude = SunLongitude - MoonLongitude
End If


If PhaseLongitude >= 0 And PhaseLongitude <= 12 Then
PhaseStartLongitude = 0
PhaseEndLongitude = 12
ElseIf PhaseLongitude >= 12 And PhaseLongitude <= 24 Then
PhaseStartLongitude = 12
PhaseEndLongitude = 23
ElseIf PhaseLongitude >= 24 And PhaseLongitude <= 36 Then
PhaseStartLongitude = 24
PhaseEndLongitude = 36
ElseIf PhaseLongitude >= 36 And PhaseLongitude <= 48 Then
....................................
....................................
ElseIf PhaseLongitude >= 168 And PhaseLongitude <= 180 Then
PhaseStartLongitude = 168
PhaseEndLongitude = 180
End If


I want "PhaseStartLongitude" & PhaseEndLongitude" as the result.

[I understand that the "Result" of this Function should be an Array with two elements eg: Result(0) = PhaseStartLongitude & Result(1) = PhaseEndLongitude. Am I correct?]

Please let me know how to write this Function.

Thanks

Regards

VKSBK



A Real Novice Programmer !

Continue reading...
 
Back
Top