Technorati Tag: String, vbcrlf, VBA, split
As follows:
-
Several Characters
- CHR (9)Tab vbtab
- CHR (10)Line feed
- CHR (13)Carriage Return vbcrlf
- CHR (32)Space, or yesSpace (1)
Msgbox Cities (1) & CHR (13) & Cities (2)
Quoted text embedded in a text string requires an additional set of quotation marks, as in"" Test.doc "".
To get the same result, you can replace CHR (9) with a VBA constant: vbtab.
Note: vbcrlf is a string of 2 characters. For example, if the last character of a string is vbcrlf, you can use the right function to retrieve the last character and ask whether it is equal to vbcrlf. The answer is false; however, if you take the rightmost 2 characters, you can get the vbcrlf
Isnumeric checks whether all strings are numbers.
Right, left, mid, and instr are all easy-to-use functions used to access individual characters in strings.
Format FunctionUsed to format strings
Split Function
-
- Public sub test ()
- Dim shoppinglist as string
- Dim shoppingitem () as string
- Shoppinglist = "milk, eggs, bread"
- Shoppingitem = Split (expression: = shoppinglist, delimiter: = ",")
- Msgbox "0:" & shoppingitem (0) & CHR (13) & "1:" & shoppingitem (1) & CHR (13) & "2:" & shoppingitem (2)
- End sub