Private Const VK_SHIFT = &H10
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private last_sel
Private Sub Form_Load()
last_sel = 0
End Sub
Private Sub DataGrid1_SelChange(Cancel As Integer)
If GetKeyState(VK_SHIFT) < 0 Then
relative = last_sel - DataGrid1.Row
Text1.Text = relative
If relative < 0 Then
For j% = relative To -1
DataGrid1.SelBookmarks.Add (DataGrid1.GetBookmark(j%))
Next j%
Else
For j% = 1 To relative
DataGrid1.SelBookmarks.Add (DataGrid1.GetBookmark(j%))
Next j%
End If
Else
last_sel = DataGrid1.Row
Text1.Text = last_sel
End If