0

I want to make an array of the values: w1, w2, w3, y1, y2, y3 ... etc, but got an error in my code:

sub array()

Dim titles() as string

For i = 1 to 3

titles(i + 0) = "w" + i
titles (i + 3) = "y" + i
titles (i + 6) = "x" + 1

'...

Next i

End sub
0

1 Answer 1

1

You were quite close:

Sub arrray()

    Dim titles(1 To 9) As String
    Dim i As Long

    For i = 1 To 3
        titles(i + 0) = "w" & i
        titles(i + 3) = "y" & i
        titles(i + 6) = "x" & i
    Next i

    For i = 1 To 9
        MsgBox titles(i)
    Next i
End Sub
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.