vba 在 Excel 中复制大量数据
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19082765/
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
Copying Large Amounts of Data in Excel
提问by user2829172
I've got a spreadsheet with around 90 identically formatted workbooks. I need to copy and paste around 336 independant formulas located in one row from a completed worksheet to all the other worksheets. Unfortunatley, this ends up being around 30k indvidual cells that need to be copied and pasted at once. Is there a workaround other than splitting it up and doing it manually?
我有一个包含大约 90 个格式相同的工作簿的电子表格。我需要将位于一行中的 336 个独立公式从已完成的工作表复制并粘贴到所有其他工作表。不幸的是,这最终需要一次复制和粘贴大约 30k 个单独的单元格。除了拆分并手动执行之外,还有其他解决方法吗?
Any help is apperciated. Thanks.
任何帮助是appercitated。谢谢。
回答by Jose M.
You can try using VBA. Something like the procedure below should get you started. The procedure below takes the information from. This procedure assumes that your formulas begin in Row A1 and end in C1, change as you need. Inside the array, list the name of the sheets you want.
您可以尝试使用 VBA。类似下面的过程应该会让你开始。下面的过程从以下位置获取信息。此过程假定您的公式从 A1 行开始并在 C1 结束,可根据需要进行更改。在数组内,列出您想要的工作表的名称。
Sub copyFormulas()
Dim rng As Range
Dim WS As Worksheet
With Sheets("The Sheet Name with the Formulas To Copy")
Set rng = .Range(.Range("A1:C1"), Range("A" & Rows.Count).End(xlUp))
End With
For Each WS In Sheets(Array("Your Destination Sheet Name Here", "And Here")) 'Add more sheets if you need to
WS.Rows(2).Resize(rng.Count).Copy
rng.Copy Destination:=WS.Range("A1")
Next WS
End Sub