J
JohnJack
Hello everyone,
Below is my function I am trying to write. The problem I am running
into is that I cannot figure out what line of code will allow me to
exit the loop once y0(1,A) = <subscript out of range>, ie there are no
more columns in the range. Can anyone point out how to trap/exit when
this error occures so that I can exit and the A value is the number of
columns in the range?
Can anyone help me out here?
Cheers,
Jack
Function SumAbs(y0 As Range)
'this function will return the sum absolute value from all the cells
in the range provided
Dim A, B, Counter,Counter2 As Integer
A = 1
Do While y0(1, A) <> ""
A = A + 1
Loop
A = A - 1
B=Application.Count(y0)/A ' this part determines how many rows are
in the y0 range by dividing the total count by the amount of columns
(A)
SumAbs=0
For Counter2= 1 to A
For Counter = 1 To B
SumAbs = SumAbs + Abs(y0(Counter, Counter2))
Next Counter
Next Counter2
End Function
Below is my function I am trying to write. The problem I am running
into is that I cannot figure out what line of code will allow me to
exit the loop once y0(1,A) = <subscript out of range>, ie there are no
more columns in the range. Can anyone point out how to trap/exit when
this error occures so that I can exit and the A value is the number of
columns in the range?
Can anyone help me out here?
Cheers,
Jack
Function SumAbs(y0 As Range)
'this function will return the sum absolute value from all the cells
in the range provided
Dim A, B, Counter,Counter2 As Integer
A = 1
Do While y0(1, A) <> ""
A = A + 1
Loop
A = A - 1
B=Application.Count(y0)/A ' this part determines how many rows are
in the y0 range by dividing the total count by the amount of columns
(A)
SumAbs=0
For Counter2= 1 to A
For Counter = 1 To B
SumAbs = SumAbs + Abs(y0(Counter, Counter2))
Next Counter
Next Counter2
End Function