Hi,
I have a user form which inputs I want to go into a table. When I submit the form, I keep getting a run-time error '9': subscript out of range.
I am using Philip Treacy's tutorial and the code seems to have the problem with adding a row to my table section and I'm running into a wall here.
Thank you!
Hi Katy,
When I try to download your file I'm getting an error saying it's corrupted.
Please attach to your reply and remove the spaces from the filename.
Thanks
Phil
Hi Phil,
Here it is.
Thanks,
Katy
Hi Katy,
You have a couple of lines of code referring to your table:
ActiveSheet.ListObjects("ESDCheckForm").ListRows.Add
Set Table1 = ActiveSheet.ListObjects("ESDCheckForm")
but your table (on the worksheet) is named Table1 not ESDCheckForm, this is what's causing the subscript out of range error
Also, when adding data from the form to the table, there are some lines of code (in red) that are trying to read values from fields in the form that don't exist:
.Cells(1, 1) = NameList.Value
'.Cells(1, 2) = Calender1.Value
.Cells(1, 3) = MatNumber.Value
'.Cells(1, 4) = ConductivityValue.Value
.Cells(1, 5) = CheckConductivity.Value
'.Cells(1, 6) = GroundingValue.Value
.Cells(1, 7) = GroundCheck.Value
.Cells(1, 8) = ESDCheck.Value
.Cells(1, 9) = Comments.Value
Please see attached file for working code.
Regards
Phil
Thanks Phil, that explains the table issue. As for the cell values, I modified the form a little and removed items(employee list names, etc) before submitting to the forum.
Again, thank you for the help!