|
楼主 |
发表于 2022-11-25 15:15
|
显示全部楼层
找到了代码,自己照葫芦画瓢改了下,最后是我想要的。B列输入到500行时,自动换到D列。以此类推
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sro, sco, ro, co
On Error Resume Next
Application.EnableEvents = False
Set mysheet1 = ThisWorkbook.Worksheets("Sheet1")
sro = Selection.Row
sco = Selection.Column
If sro > 1 And sco > 1 And sco <= 15 Then
ro = Target.Row
co = Target.Column
If ro = 500 Then
mysheet1.Cells(ro - 497, co + 2).Select
End If
If ro > 1 And ro < 10 Then
mysheet1.Cells(ro + 1, co).Select
End If
End If
Application.EnableEvents = True
End Sub |
|