I'm very new to Excel VBA and can't seem to figure out why I keep getting error 80010108 "Method 'Value' of object 'Range' failed." If anyone can help me out it would be very much appreciated!!
I created a UserForm ("MainView") with a command button ("Add New"), which brings up another UserForm ("AddNewWorkOrder") that contains another command button ("Enter"). I want this Enter command button to enter all data typed in this userform's textboxes into the corresponding columns in the active worksheet. **I need to add rows to a table in the worksheet
Now when I run MainView and then click "Add New" to bring up AddNewWorkOrder, I'm then unable to enter the data because clicking "Enter" will throw up the error 80010108 and crash Excel (prompted to restart Excel).
HOWEVER if I run the AddNewWorkOrder UserForm directly, without going through MainView, it will enter the data exactly as needed.
This is the code I have for MainView's "Add New":
Private Sub AddNew_Click()
Me.Hide
AddNewWorkOrder.Show
End Sub
This is the code I have for "Enter" (including just one textbox for simplicity):
Private Sub EnterCommandButton_Click()
Range("A" & Rows.Count).End(xlUp).Select
HoldVal = ActiveCell.Value + 1
MsgBox HoldVal
ActiveCell.Offset(1, 0).Value = HoldVal
ActiveCell.Offset(1, 1).Select
ActiveCell.Value = Me.ItemSizeTextBox
Me.Hide
MainView.Show
End Sub
Edit: the line "ActiveCell.Offset(1, 0).Value = HoldVal" is where I'm getting an error