如何自动增加单元格的输入值
How to autoincrement the entered value of cell
我想要的是自动增加单元格输入的值。
假设我在单元格中输入了 3,但我希望它自动递增,假设值 50,新值将是 53
知道我该怎么做吗?
这只是单元格 B9 的示例。在 Worksheet 代码区域安装以下宏:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("B9")) Is Nothing Then Exit Sub
If IsNumeric(Target.Value) Then
Application.EnableEvents = False
Target.Value = Target.Value + 50
Application.EnableEvents = True
End If
End Sub
我看到了@Gary 的学生回答,值得考虑。我只是在描述另一种方法。 Select 离您的工作区域有一定距离。说 R2:R100
并以您想要的增量使用工作表填充系列函数填充它。
您的 R2...R5 单元格的值为 7、14、21 等。现在在单元格 A2 中使用 =Row()+R2
并根据您的要求填写。您的 A2、A3、A4... 现在的值为 9、17、24...。您可以隐藏 R 列,使其不可见。
我想要的是自动增加单元格输入的值。
假设我在单元格中输入了 3,但我希望它自动递增,假设值 50,新值将是 53 知道我该怎么做吗?
这只是单元格 B9 的示例。在 Worksheet 代码区域安装以下宏:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("B9")) Is Nothing Then Exit Sub
If IsNumeric(Target.Value) Then
Application.EnableEvents = False
Target.Value = Target.Value + 50
Application.EnableEvents = True
End If
End Sub
我看到了@Gary 的学生回答,值得考虑。我只是在描述另一种方法。 Select 离您的工作区域有一定距离。说 R2:R100
并以您想要的增量使用工作表填充系列函数填充它。
您的 R2...R5 单元格的值为 7、14、21 等。现在在单元格 A2 中使用 =Row()+R2
并根据您的要求填写。您的 A2、A3、A4... 现在的值为 9、17、24...。您可以隐藏 R 列,使其不可见。