First time asking a question here, my apologies if my question has already been answered (If it was, I didn't understand it because I am an utter novice). My Excel userform that I use to update quantities of stock supplies used on a particular job is generating a
type mismatch error
It is supposed to add the quantity from the useform to the entry in the appropriate cell on the sheet. I assume that this has something to do with a variable not being declared correctly.
Private Sub SubmitFormButton_Click()
Dim Data_Start As Range
Dim i As Integer
Set Data_Start = ActiveSheet.Cells(6, 6)
For i = 1 To 31
Data_Start.Offset(i, 0) = Data_Start.Offset(i, 0) + AddToform.Controls("TextBox" & i).Value
Next i
Unload AddToform
End Sub
AddToformtoMeso that it references the current instance of the form.+ Val(AddToform.Controls("TextBox" & i).Value)to convert the textbox values to true numbers. TechnicallyCDblwould be more appropriate if you might not be dealing with US settings butValworks better with empty textboxes.Valwould cause the+to operate like&and simply append the data. UsingVal/CDblwould cause an error, which would probably be a good thing.