VBA点按钮依次顺序往下方单元格填入值
点击一个按钮,从指定的单元格开始填入一个值,再次点击按钮,往下一行的单元格填入一个值,再点击顺序往下填入值:
效果示例:
写法示例:
- Public Sub ButtunClick(sender As Object, e As SpreadsheetGear.Windows.Controls.ShapeActionEventArgs) Implements Interfaces.IExcelWorkBook.ButtunClick
- If e.Shape.Name = "Button 1" Then
- Dim i As Integer
- i = ActiveWorkbook.ActiveWorksheet.Range("B2").Value
- ActiveWorkbook.Worksheets("Sheet1").Cells(i, 2).Value = i
- ActiveWorkbook.ActiveWorksheet.Range("B2").Value = i + 1
- End If
- End Sub '按钮/标签点击事件
复制代码
|
|
hessen