idnoidno
01-07-2019, 10:53 PM
Type 1
Sub Break_String()
Dim WrdString As String
Dim text_string As String
text_string = "Welcome to Excel Trick"
WrdString = Split(text_string)(2)
MsgBox "The third part is : " & WrdString
End Sub
Type 2
Sub Break_String()
Dim WrdArray() As String
Dim text_string As String
text_string = "Welcome to Excel Trick"
WrdArray() = Split(text_string)
For i = LBound(WrdArray) To UBound(WrdArray)
strg = strg & vbNewLine & "Part No. " & i & " - " & WrdArray(i)
Next i
MsgBox strg
End Sub
What is the difference between the two types of use, with or without parentheses?
Sub Break_String()
Dim WrdString As String
Dim text_string As String
text_string = "Welcome to Excel Trick"
WrdString = Split(text_string)(2)
MsgBox "The third part is : " & WrdString
End Sub
Type 2
Sub Break_String()
Dim WrdArray() As String
Dim text_string As String
text_string = "Welcome to Excel Trick"
WrdArray() = Split(text_string)
For i = LBound(WrdArray) To UBound(WrdArray)
strg = strg & vbNewLine & "Part No. " & i & " - " & WrdArray(i)
Next i
MsgBox strg
End Sub
What is the difference between the two types of use, with or without parentheses?