excel中没有没办法设定一列中当所有数的和值到10后自动到下一列的办法.

2022-11-01 11:39发布

通过VBA实现Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Rang
1条回答
1楼 · 2022-11-01 12:30.采纳回答
通过VBA实现
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

If Target.Rows.Count > 1 Or Target.Columns.Count > 1 Then
Exit Sub
End If
c = Target.Column
n = Application.WorksheetFunction.Sum(Columns(c))
If n = 8 Then ‘如果是要值>=8就跳转,那就改成n>=8
Cells(1, c + 1).Select
End If
End Sub