Forum

UserForm is not inp...
 
Notifications
Clear all

UserForm is not inputting into table, not sure what I'm doing wrong

5 Posts
2 Users
0 Reactions
56 Views
(@katskin12)
Posts: 3
Active Member
Topic starter
 

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!

 
Posted : 25/03/2020 9:59 am
Philip Treacy
(@philipt)
Posts: 1631
Member Admin
 

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

 
Posted : 25/03/2020 7:34 pm
(@katskin12)
Posts: 3
Active Member
Topic starter
 

Hi Phil,

Here it is.

Thanks,

Katy

 
Posted : 26/03/2020 12:05 pm
Philip Treacy
(@philipt)
Posts: 1631
Member Admin
 

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

 
Posted : 26/03/2020 9:29 pm
(@katskin12)
Posts: 3
Active Member
Topic starter
 

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!

 
Posted : 27/03/2020 10:37 am
Share: