Sub test()
Dim Rng As Range
Set Rng = Selection
Rng.Resize(1, 8).Select
End Sub
这是选择当前选中单元格同行的八个单元格,包括原来的当前单元格
如果不包括原来的单元格
代码修改如下
Sub test()
Dim Rng As Range
Set Rng = Selection
Rng.offset(,1).Resize(1, 8).Select
End Sub
如果是按当前单元格向右第8个单元格
Sub test()
Dim Rng As Range
Set Rng = Selection
Rng.offset(, 8).Select
End Sub
如果是固定H列,代码如下
Sub test()
Dim i%
i = Selection.Row
Cells(i, 8).Select
End Sub
或直接用
Sub test()
Cells(Selection.Row, 8).Select
End Sub
此单元格向右偏移8格,还是第八列的该行?offset 或cells(r,8) r=target.row
细节问题可留扣扣