Developer technologies | Visual Basic for Applications
An implementation of Visual Basic that is built into Microsoft products.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am creating an inventory tracking spreadsheet with UserForm Entry. The button I've created to transfer the data to a table is giving me "Run-tim error 9 (Subscript out of range)". The code is as follows:
Sub CommandButton1_Click()
'Enter button
Dim rng As Range
Set rng = Worksheets("Updates").ListObjects("Table1").Range
Dim LastRow As Long
LastRow = rng.Find("", rng.Cells(1), x1Formulas, x1Part, x1ByRows, xlPrevious, False).Row
rng.Parent.Cells(LastRow + 1, 1).Value = TextBox1.Value
rng.Parent.Cells(LastRow + 1, 2).Value = TextBox2.Value
MsgBox ("Inventory Updated")
End Sub
The row in bold is the line that is highlighted when attempting to debug. What is causing this issue?