请大家回答下 我这里那出错了. 我做了2个控键 一个添加数据,另外一个删除数据, 添加得时候自动在最后面一个加,我想删除也是全部一下把所有数据删除掉,但只能删掉A1单元格,
删除控键
Private Sub CommandButton1_Click()
Dim X As Integer
X = Application.WorksheetFunction.CountA("A:A")
Range(Cells(1, 1), Cells(X, 1)).ClearContents
End Sub
添加控键
Private Sub CommandButton2_Click()
Dim I As Integer
Dim X As Integer
For I = 1 To 20
Sheets("Sheet1").Cells(I, 1) = I
Next I
X = Application.WorksheetFunction.CountA(Range("A:A"))
Cells(X + 1, 1).Value = Application.WorksheetFunction.Sum(Range(Cells(1, 1), Cells(X, 1)))
End Sub
有这么好得老师,又有这么热心得同学,在这里学习很开心.
[此贴子已经被作者于2004-10-21 0:50:49编辑过] |