'Object Required'错误VBA试图保存细节

有人可以帮帮我吗?

基本上,我有三个文本框在我的Excel电子表格,我有一个button,我想保存到另一个工作表上的细节。

每一行都作为一个“x”在其中,以便程序可以知道在哪里保存下一个数据。

当我点击保存button时,出现一个错误,说'对象需要'。

我是VBA的上帝,我真的不知道,所以也许试着用愚蠢的话来保留答案,所以我不会搞砸了吗? 我可能做了一些小错,但我不确定。 这是我的代码:

Public Function findrow(texttofind As String) As Integer Dim i As Integer Dim firstTime As Integer Dim bNotFound As Boolean i = 5 bNotFound = True Do While bNotFound If Cells(i, 1).Value = texttofind Then firstTime = i bNotFound = False End If i = i + 1 Loop findrow = firstTime End Function Sub SaveCustomer() Dim rowno As Integer Worksheets("Customers").Select rowno = findrow("x") Range("C" & rowno).Value = Invoice.TextBox21.Text Range("D" & rowno).Value = Invoice.TextBox22.Text Range("E" & rowno).Value = Invoice.TextBox23.Text Worksheets("Invoice").Select End Sub 

我对VBA真的很不好,老师也不好,我只需要解决这个问题,我就可以通过我的任务。 我只想将来自3个文本框的信息保存到另一个表格中的表格中。 感谢您收到的任何帮助!

我很抱歉,如果这是重复的,但因为我在VBA如此糟糕,其他问题的答案根本没有帮助我。

更换

  Range("C" & rowno).Value = Invoice.TextBox21.Text Range("D" & rowno).Value = Invoice.TextBox22.Text Range("E" & rowno).Value = Invoice.TextBox23.Text 

  Range("C" & rowno).Value = Worksheets("Invoice").TextBox21.Text Range("D" & rowno).Value = Worksheets("Invoice").TextBox22.Text Range("E" & rowno).Value = Worksheets("Invoice").TextBox23.Text