Can someone please help me?
Basically, I have three textboxes in my Excel spreadsheet, and I have a button that I want to save the details into a table on another sheet.
Each row as an 'x' in it, so that the program can know where to save the next data.
When I click the save button, an error comes up saying 'Object required.'
I'm god awful at VBA, seriously I have no clue, so maybe try to keep the answer in stupid-man terms so I don't mess up? I'm probably doing something minor wrong but I'm not sure. Here's my code:
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
I'm really bad at VBA, and my teacher isn't great, I just need to fix this one thing so I can pass my assignment. I just want to save the information from 3 textboxes into a table in another sheet. Thanks for any help received!
I'm sorry if this is a duplicate, but because I'm so bad at VBA, answers to other questions don't really help me at all.