Microsoft Office Tutorials and References
In Depth Information
Figure 19-15. A worksheet with text to be parsed in A1:A3
ConsecutiveDelimiter:=True, Comma:=True, _
FieldInfo:=Array(Array(1, 2), Array(2, 3))
produces the second and third columns of Figure 19-15 . Note that the cells in column C are
formatted as dates.
Figure 19-15. A worksheet with text to be parsed in A1:A3
On the other hand, if DataType is xlFixedWidth , the first element of each two-element array
specifies the starting character position in the column (0 being the first character) and the second
element specifies the parse option (1-9) for the resulting column, as described previously.
To illustrate, consider the worksheet in Figure 19-16 . The code:
Range("A1:A3").TextToColumns _
Destination:=Range("B1"), _
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 2), _
Array(1, 9), Array(2, 2), Array(5, 9), _
Array(6, 2))
parses the first column of Figure 19-16 into the remaining columns. (Note how we included arrays
to skip the hyphens.)
Figure 19-16. A worksheet with fixed-width data to be parsed in A1:A3
19.3.48 Value Property
The Value property returns the value of the specified cell. If the cell is empty, Value returns an
empty string. This can be tested in either of the following ways:
If Range("A1") = "" Then . . .
If IsEmpty(Range("A1")) Then . . .
If the Range object contains more than one cell, the Value property returns a two-dimensional
array. For instance, referring to Figure 19-16 , the code:
Dim v As Variant
v = Range("A1:A3").Value
Debug.Print IsArray(v)
Search JabSto ::

Custom Search