Excel: Byte in Backward Loop


Hi, . Sorry- probably an obvious answer. But Googling gave mostly only guesses. . I prefer sometimes to limit things initially in size and so often dimension variables as Byte ( 0 - 255 ). . I noticed something Weird. . This works:

Sub TestByteloopForwards()
Dim Count As Byte
  For Count = 1 To 2 Step 1
  MsgBox "Hi Weld"
  Next Count
End Sub
. This does not:
Sub TestByteloopBackwards()
Dim Count As Byte
  For Count = 2 To 1 Step -1
  MsgBox "Hi Weld"
  Next Count
End Sub
. Obviously I can change to an Integer or even something bigger. .. But I am learning, and would be interested to find out why . Any ideas? Thanks Alan


This question generated 11 answers. To proceed to the answers, click here.

This thread is current as of September 05, 2014.


For more resources for Microsoft Excel