简体   繁体   English

如何使用宏将数据从一张纸复制到Excel 2007中的另一张纸?

[英]How can I copy data from one sheet to another sheet in Excel 2007 using a macro?

I am using MS Office 2007. How can I copy whole data from sheet one to sheet two? 我正在使用MS Office2007。如何将整个数据从第一张复制到第二张? I want to copy the whole data from row 5 to onward in sheet two. 我想将整个数据从第5行复制到第二页的开头。 The whole scenario is given below in detail. 整个方案在下面详细给出。

Sheet one: 第一页:
Copy the data from column B and Row 3 复制B列和第3行中的数据

Sheet Two: 第二页:
Paste the Copied Data in Column B and Row 3 将复制的数据粘贴到B列和第3行中

Sheet One: 第一张:
Copy the whole data from Column B to Column G and Row 5 to onward 将整个数据从B列复制到G列,然后将第5行复制到前面

Sheet Two: 第二页:
Paste whole copied data in sheet two from last filled row to onward 从最后填充的行到第二行将整个复制的数据粘贴到第二页中

Data doesn't overwrite on any row or column. 数据不会在任何行或列上覆盖。 Every data will be added in sheet two from sheet one when macro will be run. 运行宏时,每个数据将从第一页添加到第二页。

The best way to learn how to do this is to record a macro. 学习如何执行此操作的最佳方法是记录宏。 Excel has a very good macro recorder. Excel具有非常好的宏记录器。 Just start to record a new macro, then manually perform all the steps you describe in your question. 刚开始记录一个新的宏,然后手动执行您在问题中描述的所有步骤。 After you have finished, stop the macro recorder and take a look at the code that Excel generated for you. 完成后,停止宏记录器,并查看Excel为您生成的代码。

Alt+F11 is the shortcut key to get to the VBA code editor in Excel. Alt + F11是进入Excel中的VBA代码编辑器的快捷键。

This should do the trick. 这应该可以解决问题。 But before you try, do a SaveAs to a different file, so if it doesn't give the desired results you can go back to the other version. 但是,在尝试之前,请对其他文件执行SaveAs操作,因此,如果未提供所需的结果,则可以返回到其他版本。 There are no Undos with macros. 没有宏撤消。

Sub CopyInfo()
    Sheet2.Range("B3").Value = Sheet1.Range("B3").Value
    Sheet1.Range("B5:G65000").Copy
    Sheet2.Range("B5").Paste
    Application.CutCopyMode = False
End Sub

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何仅从一个Excel工作表复制公式,该工作表可以使用宏动态增长到另一工作表 - How to copy only formulas from one excel sheet which can dynamically grow to another sheet using macro 如何在Excel 2007中获取数据以从一张纸“填充”到另一张纸? - How can I get data to 'fill' from one sheet to another in excel 2007? 使用宏将数据从Excel工作表复制到另一个工作表 - Copy data from excel sheet to another using macro Excel 2007 VBA:如何从一张纸上的动态范围复制和粘贴到另一张纸的第一行? - Excel 2007 VBA: How do I copy and paste from a dynamic range on one sheet to the first empty row of another sheet? 如何将数据从一个Excel工作表复制到另一个Excel工作表? - How do I copy data from one excel sheet to another excel sheet? 如何使用 Python 将数据从一个 Excel 工作表复制到同一工作簿的另一工作表? - How to copy data from One Excel sheet to another sheet for same Workbook Using Python? 使用excel VBA将数据从一张纸复制并粘贴到另一张纸,然后从第二张纸复制到第三张纸 - Copy and paste data from one a sheet to another sheet, and from second sheet to third using excel VBA 将数据从一个 Excel 工作表复制到另一个 Excel 工作表 - Copy data from one excel sheet to another excel sheet 将 excel 数据从一张纸复制到另一张纸 - Copy excel data from one sheet to another Excel宏复制单元格范围并将数据粘贴到另一个工作表 - Excel Macro Copy cell range & paste data one sheet to another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM