Specifying the Index Range of an Array
Sub ArrayExample()
Dim acWeeklySales(1 To 7) As Currency
Dim n As Integer
Dim sDay As String
acWeeklySales(1) = 55100.44
acWeeklySales(2) = 43666.43
acWeeklySales(3) = 67004.11
acWeeklySales(4) = 87121.29
acWeeklySales(5) = 76444.94
acWeeklySales(6) = 98443.84
acWeeklySales(7) = 87772.37
For n = 1 To 7
sDay = Choose(n, "Mon", "Tue", "Wed", "Thu","Fri", "Sat", "Sun")
Debug.Print"Sales for " & sDay & " were $" & acWeeklySales(n)
Next
End Sub
Related examples in the same category