Skip to main content Link Search Menu Expand Document (external link) Copy Copied

ShiftRecord

Moves the Record the specified number of times in the current instance.


Syntax

expression.ShiftRecord(aIndex, Shift)

Parameters

Part Description
aIndex Required. Identifier specifying a Long Type variable. Represents the index of the Record to be shifted.
Shift Required. Identifier specifying a Long Type variable. Represents the number of positions the Record will shift.

Returns value

Type: CSVinterface


See also
ImportFromCSV method, ImportFromCSVstring method.

Behavior

The ShiftRecord method will move the record down if the Shift is a positive integer, otherwise the record will be shifted up.

☕Example

Sub ShiftRecord()
    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
        .ShiftRecord 4, -1                              'Shift the 5th record up by 1 position
        .ShiftRecord 3, 1                               'Shift the 4th record down by 1 position
    End With
    Set CSVint = Nothing
End Sub

Back to Methods overview