|
我今天刚开始学vba,照着书上打了一个程序,程序代码如下:
Private Sub CommandButton1_Click()
Range("D8").Select
Selection.End(xlDown).Select
Selection.End(xlToLeft).Select
ActiveCell.Offset(1, 0).Range("A1") = TextBox1.Text
ActiveCell.Offset(1, 0).Range("B1") = TextBox2.Text
ActiveCell.Offset(1, 0).Range("C1") = TextBox3.Text
ActiveCell.Offset(1, 0).Range("D1") = TextBox4.Text
ActiveCell.Offset(1, 0).Range("E1") = TextBox5.Text
End Sub
Private Sub CommandButton2_Click()
End
End Sub
Private Sub CommandButton3_Click()
TextBox1.Text = "88"
TextBox2.Text = "Michael"
TextBox3.Text = "123455"
TextBox4.Text = "1322"
TextBox5.Text = "Record for test"
End Sub
当我运行时,报错: run time error '1004' application-defined or object-defined error , debug 时, 显示这一行有错:
ActiveCell.Offset(1, 0).Range("A1") = TextBox1.Text
不知道谁能指点一下,困惑好久了。不胜感谢。
|
|