'在设计时右键点击Datagrid1,进入属性...-> 键盘,将Tab动作选为2,将右边的复选框全部选上,加上如下代码即可实现你要的功能
Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
SendKeys "{Tab}"
End If
End Sub
Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
SendKeys "{Tab}"
End If
End Sub
If KeyAscii = vbKeyReturn Then
If grdDataGrid.Col = grdDataGrid.Columns.Count-1 Then
If grdDataGrid.Row < grdDataGrid.VisibleRows - 2 Then
grdDataGrid.Row = grdDataGrid.Row + 1
grdDataGrid.Col = 0
End If
Else
SendKeys "{Tab}"
End If
End If