vba 在不同工作表中添加另一行时向表中添加新行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17043311/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
adding a new row to a table when adding another row in a different sheet
提问by Gutanoth
I have an excel workbook in wich i have several tables. On 3 of my sheets, there is some kind of "main" table wich differ a bit from one another.
我有一个 excel 工作簿,里面有几张桌子。在我的 3 张床单上,有一种“主”表,彼此之间略有不同。
These tables are 2 lines by default (1 header and 1 data row) and extend when I add a new line below the one already existing. In some of the fields are formulas wich are using values from the other tables. However, if for example, I insert a new value in a field below the final row, thus adding another row to the table, I want the tables in the other sheets to also add another row (and execute the formulas that are in the new row)
这些表默认为 2 行(1 个标题和 1 个数据行),并在我在现有行下方添加新行时扩展。在某些字段中是使用其他表格中的值的公式。但是,例如,如果我在最后一行下方的字段中插入一个新值,从而向表中添加另一行,我希望其他工作表中的表也添加另一行(并执行新排)
This is the sheet in wich i have "Soorten Vezels" with their corresponding "max demping" and "soorten connectoren" with their corresponding "max demping"
这是我有“Soorten Vezels”及其相应的“max demping”和“soorten connectoren”及其相应的“max demping”的表格
This is the "maximale demping" file
这是“最大降级”文件
This is the measurement form, in this form, the user should not have to enter anything, except for the 2 dropdown menu's "type kabel" and "type connector"
这是测量表格,在这个表格中,用户不需要输入任何东西,除了2个下拉菜单的“type kabel”和“type connector”
What I would like is that when the user for example, inputs the lenght ("lengte") in the "maximale demping" file, a new row gets added (the fields "kabelnr" , "van" and "naar" will be filled in automatically from the "gegevens" file)
我想要的是,例如,当用户在“maximale demping”文件中输入长度(“lenght”)时,会添加一个新行(字段“kabelnr”、“van”和“naar”将被填充自动从“gegevens”文件中输入)
But I would also like the workbook to add a new line in the measurement form, automatically fills in the "kabelnr" , "van" and "naar" fields. So that I only have to choose the "type kabel" and " type connector" from the dropdown menu.
但我也希望工作簿在测量表单中添加一个新行,自动填写 "kabelnr" 、 "van" 和 "naar" 字段。这样我只需从下拉菜单中选择“type kabel”和“type connector”。
How do I do this (with vba)?
我该怎么做(使用 vba)?
采纳答案by Yvette
Personally I like the MSDN when I am looking for answers to VBA and vb.net. I have found it to be thorough and comprehensive. The more I learn, the more I understand what they are teaching on this site.
当我寻找 VBA 和 vb.net 的答案时,我个人喜欢 MSDN。我发现它是彻底和全面的。我学得越多,我就越了解他们在这个网站上教的东西。
This is a good tutorial to get started. Follow the links from this page.
这是一个很好的入门教程。按照此页面中的链接操作。
Getting Started with VBA in Excel 2010
Excel 2010 中的 VBA 入门
http://msdn.microsoft.com/en-us/library/office/ee814737(v=office.14).aspx
http://msdn.microsoft.com/en-us/library/office/ee814737(v=office.14).aspx
Also remember to search Stack Overflow as you progress, there are an amazing number of questions covering specifics you may require when you start, or ask more questions.
还记得随着你的进步搜索 Stack Overflow,有很多问题涵盖了你开始时可能需要的细节,或者提出更多问题。
If you require further assistance you can look at the links below.
如果您需要进一步的帮助,您可以查看以下链接。
This link is helpful. But I would navigate through the links below to get a broader view and to find an explanation that works for you.
这个链接很有帮助。但我会浏览下面的链接以获得更广泛的观点并找到适合您的解释。
Insert Row in Tables Multiple Sheets Excel 2010
在表格中插入行多张 Excel 2010
http://chandoo.org/forums/topic/insert-row-in-tables-multiple-sheets-excel-2010
http://chandoo.org/forums/topic/insert-row-in-tables-multiple-sheets-excel-2010
A forum- this link leads to a question about inserting rows. MrExcel.com
论坛 - 此链接指向有关插入行的问题。卓越先生网
http://www.mrexcel.com/forum/excel-questions/58685-insert-rows-between-different-data-2-a.html
http://www.mrexcel.com/forum/excel-questions/58685-insert-rows-between-different-data-2-a.html
If you persevere, down the page, there is good discussion, with code examples and trouble shooting (you will get a pop up when you go to this link asking to sign up for the newsletter, you can disregard this without a problem)
如果您坚持不懈,在页面下方,会有很好的讨论,包括代码示例和故障排除(当您转到此链接时会弹出一个要求注册时事通讯的链接,您可以毫无问题地忽略它)
Insert Row in Tables Multiple Sheets Excel 2010
在表格中插入行多张 Excel 2010
http://chandoo.org/forums/topic/insert-row-in-tables-multiple-sheets-excel-2010
http://chandoo.org/forums/topic/insert-row-in-tables-multiple-sheets-excel-2010
A useful Q&A from Microsoft forum.
来自 Microsoft 论坛的有用问答。
Insert blank rows in excel table with vba
使用vba在excel表中插入空白行
Please let me know if this helps and ask new questions freely as you go.
请让我知道这是否有帮助,并在您进行时自由提出新问题。