series 1,2,3,4,5,4,3,2,1,2,3,4,5,4,3,2,1

  • Thread starter Thread starter HARSHAWARDHAN. S .SHASTRI
  • Start date Start date
H

HARSHAWARDHAN. S .SHASTRI

I am looking for code which can generate following series.

1
2
3
4
5
4
3
2
1
2
3
4
5
4
3
2
1
Pl help.

H S Shastri
 
HARSHAWARDHAN. S .SHASTRI said:
I am looking for code which can generate following series.

1
2
3
4
5
4
3
2
1
2
3
4
5
4
3
2
1


Strange!?

Debug.Print 1
For k = 0 To 99
Debug.Print 2 + (k Mod 8) _
- (2 * ((k Mod 8) \ 4) * (((2 * k) Mod 8) \ 2 + 1))
Next k
 
HARSHAWARDHAN. S .SHASTRI said:
I am looking for code which can generate following series.

vstep = 1
vout = 1
For k = 1 To 99
For j = 1 To 4
Debug.Print vout
vout = vout + vstep
Next
vstep = vstep * -1
Next

or ....

Dim a As Variant
a = Array(1, 2, 3, 4, 5, 4, 3, 2)
For k = 1 To 99
For i = 0 To 7
Debug.Print a(i)
Next
Next
 
Back
Top