Parse Method

Applies To

Range Object.

Description

Parses a range of data and breaks it into multiple cells. Distributes the contents of the range to fill several adjacent columns; the range can be no more than one column wide.

Syntax

object.Parse(parseLine, destination)

object

Required. The range to parse.

parseLine

Optional. The parse line, as a string. This is a string containing left and right brackets to indicate where the cells should be split. For example, "[xxx][xxx]" would put the first three characters into the first column, and the next three characters into the second column of the destination range. If omitted, Microsoft Excel guesses where to split the columns based on the spacing of the top left cell in the range. If you want to use a different range to guess the parse line, use a Range as the parseLine argument. That range must be one of the cells that is being parsed. The parseLine argument cannot be longer than 255 characters, including the brackets and spaces.

destination

Optional. A range indicating the upper-left corner of the destination for the parsed data. If omitted, Microsoft Excel will parse in place.

Example

This example divides telephone numbers of the form 206-555-1212 into two columns. The first coulmn contains only the area code, and the second column contains the 7-digit telephone number with the embedded hyphen.


Worksheets("Sheet1").Columns("A").Parse _
    parseLine:="[xxx] [xxxxxxxx]", _
    destination:=Worksheets("Sheet1").Range("B1")