[英]Excel VBA code to submit multiple userform data to populate worksheet
Super new to coding, please help and please excuse the lack of general knowledge: 编码超级新手,请帮忙,请原谅缺乏一般知识的人:
Is there a match function equivalent in VBA? VBA中有匹配功能吗?
I have a userform that has the following: - a combobox to select employee name - a comboboc to select project number - text box to input hours worked - text box to input OT hours worked 我有一个具有以下内容的用户窗体:-用于选择员工姓名的组合框-用于选择项目编号的组合框-用于输入工作时间的文本框-用于输入工作时间的文本框
On Sheet2 named "Template for Input" I have a sheet that needs to stay in this format: Project Numbers going accross in starting in Row B11 and Employee Names listed in vertically starting in ColumnA12. 在名为“输入模板”的Sheet2上,我有一张工作表需要保持这种格式:从B11行开始的项目编号和从ColumnA12开始的垂直列出的员工姓名。 Each name is duplicated to allow for RegHrs and OTHrs.
每个名称都重复以允许RegHrs和OTHrs。
Example: 例:
Project 1 Project 2 Project 3
Doe, Jane 母鹿,简
RegHrs 注册表
Doe, Jane 母鹿,简
OTHrs 其他
Smith, John 史密斯,约翰
RegHrs 注册表
Smith, John 史密斯,约翰
OTHrs 其他
I need my Submit Hours commandbutton in the userform and have the data selected populate the worksheet in the appropriate columns/rows. 我需要在用户窗体中使用“提交时间”命令按钮,并在选定的数据中将工作表填充到适当的列/行中。 For instance if entry is Doe, Jane Project 2, 40 RegHrs 6 OT Hrs.
例如,如果输入的是Doe,Jane Project 2,则为40 RegHrs 6 OT Hrs。 How do I write the code so when the click submit it populates Jane's hours in the right spot??
我该如何编写代码,以便在单击提交时在正确的位置填充Jane的工作时间?
I also would need it to clear the userform so they can input the next employees hours until they are finished and hit close. 我还需要它来清除用户表单,以便他们可以输入下一个员工的小时数,直到他们完成工作并结束交易。
I hope that wasn't too confusing. 我希望不要太困惑。 I appreciate all of the help~~~
感谢所有的帮助~~~
so, the code that you will write in your UserForm Submit Hours command button Click event needs to perform the following actions: 因此,您将在“用户窗体提交时间”命令按钮“ 单击”事件中编写的代码需要执行以下操作:
you know, you could add Named ranges using the row titles in the Left column, and the column titles above to make it easier. 您知道,可以使用“左”列中的行标题和上方的列标题来添加“命名范围”,以使其更加容易。
So, after you have written some code come back to us if you need help 因此,在编写一些代码后,如果需要帮助,请联系我们
Here are a few other website for your reading: 以下是一些其他网站供您阅读:
Best of luck 祝你好运
Philip 菲利浦
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.