Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
subscript out of range - how to determine
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Subscript out of range | Excel Programming | |||
Subscript Out of Range | Excel Programming | |||
Subscript Out of Range | Excel Programming | |||
subscript out of range | Excel Programming | |||
Subscript out of range | Excel Programming |