ShiftField
Moves the field the specified number of times in all records of the current instance.
Syntax
expression.ShiftField
(aIndex, Shift)
Parameters
Part | Description |
---|---|
aIndex | Required. Identifier specifying a Long Type variable. Represents the index of the field to be shifted. |
Shift | Required. Identifier specifying a Long Type variable. Represents the number of positions the field will shift. |
Returns value
Type: CSVinterface
- See also
- ImportFromCSV method, ImportFromCSVstring method.
Behavior
The ShiftField
method will move the field to the right if the Shift
is a positive integer, otherwise the field will be shifted to the left.
☕Example
Sub ShiftField()
Dim CSVint As CSVinterface
Set CSVint = New CSVinterface
With CSVint.parseConfig
.path = Environ("USERPROFILE") & "\Desktop\Demo_100000records.csv"
End With
With CSVint
.ImportFromCSV .parseConfig
On Error Resume Next
.ShiftField 1, 1 'Shift the 2nd field to the right by one position
.ShiftField 2, -1 'Shift the 3th field to the left by one position
End With
Set CSVint = Nothing
End Sub