如果条件为 ,则将 Excel 中的行复制到工作表。
我正在尝试根据 D 列中的数据将工作表“全部”的整行复制到另一张工作表。D 列(家庭作业/高级/初学者)中有多个值,并且需要复制这些行才能拥有的工作表相应的名称。 (作业到作业表。)
“全部”表中的数据将被添加到其中,并且需要复制新数据,而不是复制已有的数据。
I'm trying to copy entire rows of the Sheet ‘All’ to another sheet according to the data in column D. There are multiple values in column D (Homework/Advanced/Beginner) and the sheets these rows need to be copied to have corresponding names. (Homework to Homework sheet.)
The data in Sheet ‘All’ will be added on to and the new data needs to be copied without duplicating the ones that are already there.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是什么大问题。最好的办法是让事情保持简单,并在“所有”发生变化时复制所有内容。我在“全部”工作表上有一个“重新分配”按钮,并让事件调用 scatterRows()
你没有说你的源工作表是什么样子,所以我为工作表“全部”做了一些准备:
代码相当灵活;它会找到整个源块,因此只要“D”列包含工作表键并且数据从 A1 开始(无标题),有多少列并不重要。如果您有标题,请将所有 A1 引用更改为 A2。
其他工作表(“作业”等)必须已创建。 --并且您需要 Microsoft 脚本运行时的参考集。
代码中唯一“有趣”的部分是计算目标范围的字符串 (putString)。
It's not a big problem. The best thing is to keep things simple and copy everything whenever "all" changes. I'd have a "Redistribute" button on the "all" sheet and have the event call scatterRows()
You don't say what your source sheet looks like so I made something up for sheet "all":
The code is fairly flexible; it finds the whole source block, so it doesn't matter how many columns you have as long as column "D" holds the sheet key and the data starts in A1 (no headings). If you have headings, change all the A1 references to A2.
The other sheets ("homework" etc) must have been created. --And you need a reference set to the Microsoft Scripting Runtime.
The only "interesting" part of the code is figuring out the string for the target range (putString).