![](/img/trans.png)
[英]Excel VBA look through sheets and copy column range to another sheet
[英]looping through sheets to copy value in a certain range to another sheet
我开始学习我的 VBA Excel 之旅
我有一个项目要做:遍历工作表中的不同工作表并复制工作表中特定范围内的值并将这些值复制到一张工作表中。 我怎么能做到这一点?
Sub LoopAndCopy
Dim ws as Worksheet
dim target as worksheet
set target = worksheets("target sheet name goes here") 'sheet you're copying to
For each ws in ThisWorkbook.worksheets 'loop through worksheets
if ws.name <> target.name then 'if not the target sheet then...
'copy your range into the next blank row in column A
ws.range("your range here").copy target.range("A" & rows.count).end(xlup).offset(1,0)
end if
next ws
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.