PDA

View Full Version : Excel Userform VBA code to submit to worksheet



JEPG45
06-23-2015, 01:12 AM
After numerous You Tube videos and 'how to's' I have no shame in admitting i'm stuck! Here's hoping I can appeal to your better nature and ask for some help in getting the code I need for my Excel userform.

I have an excel sheet and have created a userform to make data entry easier. So far so good and no problems. However I can't comprehend the code neeeded to submit the data from the form into the excel sheet. The form should be completed and then that data should create a new row of daata underneath the existing column headings

The userform is comprised of one text box, 3 combo boxes and then 34 Yes/No check boxes. I have attached the spreadhseet and would be so appreciative if someone could take a look and at least get me going with the code I need to enter.

Thank you so much in advance

paulked
06-25-2015, 01:57 PM
Here's a starting point.

I would rename the checkboxes with a number at the end corresponding to the column the data goes into. This would make it easy for a for-next loop to fill the row with the Y/N values.

SamT
06-25-2015, 02:38 PM
All UserForm Controls have a Tag Property for general use by the Programmer. Put the column number in the Tag and then


For each Ctrl in Me.Controls
With Ctrl
If .Tag <> "" Then Cells(RowN, .Tag) = .Value
End With
Next Ctrl

paulked
06-25-2015, 03:28 PM
I've always wondered what the tag was for! Many thanks for the info, I wish I'd known about it years ago... would have saved me hours of work!