在 VBA 中与 column=-1 的偏移量

offset with column=-1 in VBA

当 selecting 列 =-1 时,我正试图找到问题的解决方案 首先我 select 单元格 A1,然后我应用此代码。

 Sub exc()
ActiveCell.Offset(-1, 0).Select
If .Offset(-1, 0).Row < 1 Then
ActiveCell.Offset(1, 0).Select
End If
End Sub

但是问题没有解决

感谢您的帮助。

做偏移前需要测试:

Sub exc()
IF Activecell.Row > 1 then
     ActiveCell.Offset(-1, 0).Select
Else
    ActiveCell.Offset(1, 0).Select
End If
End Sub