我阅读了多个Q&A,但是我很难真正理解使用不同对象的所有长文字。
我试图从一个工作表中选择一个范围到另一个工作表。 我想保持范围动态,因为范围可以每次都有所不同。 通过这样做,我使用了以下脚本:
Dim range As Long For range = ActiveCell To ActiveCell.End(xlDown) Sheets("Stock Report").range("A4" & range).Value = Sheets("Unique File").range("Y8" & range).Value但它什么都不做。
这个脚本可以工作,但我想保持最后一个单元格的动态:
Sheets("Stock Report").Range("A4:A9000").Value = Sheets("Unique File").Range("Y8:Y90004").Value我必须对多个列进行此操作,这些列是通过使用不同工作表中的其他文件计算出来的,并且最终需要对它们进行排序,而不必在另一个列表中进行所有计算。
有什么建议么?
I read multiple Q&A's, however it's difficult for me to really understand all the long scripts with the usage of different objects.
I am trying to select a range from one worksheet to an other. I want to keep the range dynamic, because the range can vary every time. By doing so I have used the following script:
Dim range As Long For range = ActiveCell To ActiveCell.End(xlDown) Sheets("Stock Report").range("A4" & range).Value = Sheets("Unique File").range("Y8" & range).ValueHowever it doesn't do anything.
This script does work, but I would like to keep the last cell dynamic:
Sheets("Stock Report").Range("A4:A9000").Value = Sheets("Unique File").Range("Y8:Y90004").ValueI have to do this for multiple columns which are calculated by using other files in a different worksheets and need to sort them finally without all the calculations in an other one.
Any suggestions?
最满意答案
好的,试试。
Sheets("Unique File").Range("Y8:Y" & Sheets("Unique File").Range("A4").End(xlDown).Row + 4).Copy Sheets("Stock Report").Range("A4").PasteSpecial Paste:=xlPasteValues范围(“A4”)。结束(xlDown).Row获取库存报表工作表上数据的最后一行,并用于复制到唯一文件表单中的同一行。 我添加了4,因为您的范围从唯一文件工作表上的8开始。
我认为你的代码不起作用,因为你试图使用从“唯一值”工作表上的“库存报表”中创建的“范围”。
OK try.
Sheets("Unique File").Range("Y8:Y" & Sheets("Unique File").Range("A4").End(xlDown).Row + 4).Copy Sheets("Stock Report").Range("A4").PasteSpecial Paste:=xlPasteValuesRange("A4").End(xlDown).Row gets the last row of the data on the Stock Report sheet and is used to copy down to the same row on the Unique File sheet. I added 4 because your range starts on 8 on the Unique File sheet.
I think your code didn't work because you were trying to use the "range" you created from the Stock Report sheet on the Unique values sheet.
更多推荐
发布评论