please help I can not mergeCode:Private Sub Command1_Click()
Dim a As String, i As Long
Dim b() As String
For i = 1 To 15
a = "test" & i
b = join(a, "# ") '<<<< Can't Assign to Array
Next
MsgBox b
End Sub
Printable View
please help I can not mergeCode:Private Sub Command1_Click()
Dim a As String, i As Long
Dim b() As String
For i = 1 To 15
a = "test" & i
b = join(a, "# ") '<<<< Can't Assign to Array
Next
MsgBox b
End Sub
VB's Join method combines an array to a single string variable. VB's Split takes a single string variables and creates an array. Review your help files.
dim b(1 to 15) as string
in your for loop:
b(i) = a(i) & "# "
Are you trying to do this?
vb Code:
Private Sub Command1_Click() Dim a(1 To 15) As String, i As Long Dim b As String For i = 1 To 15 a(i) = "test" & i Next b = join(a, "#") MsgBox b End Sub
Now that we've helped you, you can help us by marking the thread as resolved. If you have JavaScript enabled you can do that easily by pulling down the Thread Tools menu and selecting the Mark Thread Resolved item. Also if someone has been particularly helpful you have the ability to affect their forum "reputation" by rating their post.