|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
试试:
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- On Error Resume Next
- If Target.Count > 1 Then Exit Sub
- If ActiveCell.Row < 2 And KeyCode = 38 Then Exit Sub
- If ActiveCell.Column < 2 And KeyCode = 37 Then Exit Sub
- Application.EnableEvents = False
- Cells.Interior.ColorIndex = 0
- With ActiveCell
- If KeyCode = 37 Then .Offset(0, -1).Select '键盘 左 键
- If KeyCode = 38 Then .Offset(-1, 1).Select '键盘 上 键
- If KeyCode = 39 Then .Offset(0, 0).Select '键盘 右 键
- If KeyCode = 40 Then .Offset(1, 0).Select '键盘 下 键
- End With
- Application.EnableEvents = True
- Target.Interior.ColorIndex = 3
- End Sub
复制代码 |
|