Hi mommyshe,
Here I've got 2 example that you can use as your sample program that has an arrays.
In the first example you need to open a form and put one command button. Then apply this code.
Option Explicit
Dim MyMonth, ThisY2k
Dim i As Integer
Private Sub Command1_Click()
For i = 0 To 3
Print Tab(30); ThisY2k(i)
Next
End Sub
Private Sub Form_Load()
ThisY2k = Array("Cat", "Mouse", "Dog", "Cat")
'Return value assume lower bound = 1
MyMonth = ThisY2k(0)
'You can change value in the bracket from 1-4
End Sub
For the second example, just open a form and put two command button in it. Apply this code.
'Initializing an array
Option Explicit
Private Sub Command1_Click()
Dim s(9) As Integer
Dim x As Integer
Call Cls
'Initialize array to even elements
For x = LBound(s) To UBound(s)
s(x) = 2 + 2 * x
Next x
Print "Index" & Space$(3) & "Value"
For x = LBound(s) To UBound(s)
Print Space$(2) & x & Space$(7) & s(x)
Next x
End Sub
Private Sub Command2_Click()
End
End Sub
You can try this first and if this simple enough than you can use it.
Enter your message below
Sign in or Join us (it's free).