在 Excel 2003 中使用 VBA 编程
我是视觉基础语言的新手,希望在编写一些代码时获得一些帮助。因此,我正在尝试编写一个程序,从电子表格导入数据并转移当前数据。所以我有一个包含 3 张纸的电子表格文件。我会首先删除第三个也是最后一个工作表中的数据,然后将数据从第二个工作表剪切并复制到第三个工作表,然后将第一个工作表剪切到第二个工作表。然后提示用户选择要导入到第一张工作表的数据文件。我该怎么做呢? 谢谢
I'm new to the visual basics language and would like some help in writing some codes. So I'm trying to write a program that imports data from a spreadsheet and shifts current data over. So I have a spreadsheet file with 3 sheets. I would first delete the data in the third and last sheet, then cut and copy the data from the second sheet over to the third sheet and the first to the second. and then prompt the user to select a data file to import to the first sheet. How do I go about doing this ????
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
其中行和列都是数字来访问每个单元格。您可以这样设置值
您可以这样访问值
如果您想将数据从一个工作表复制到另一个工作表,此代码会将前 26 列和行从工作表 2 复制到工作表 3...
You can access each cell by using
Where the row and column are both numeric. You can set the values like this
You can access the values like this
If you want to copy data from one worksheet to another, this code will copy the first twenty six columns and rows from worksheet 2 to worksheet 3...
您可以通过执行以下命令简单地删除第三个工作表:
然后插入一个新工作表并将其放置在工作表 1 和工作表 2 之前
然后用您可能想要的任何数据填充该工作表。您在问题中没有包含有关数据来源的任何详细信息,所以我想您已经知道了。
You could simply delete the third sheet by executing:
Then insert a new sheet and place it before Sheet 1 and 2
Then fill the sheet with any data that you may want to. You did not include any details in your question about what is the source of the data, so I guess, you already know about that.