[英]vba copy and paste loop based on list
我相信以下應該有效,為了安全起見,我會刪除 Medina-15-17 第 11 行中的數據:
'The 2 refers to column "B" on the Master worksheet, change to 1 if in column "A"
summary_row = Worksheets("Master").Cells(Rows.Count, 2).End(xlUp).Row
For Each cell In Worksheets("Master").Range("B2:B" & summary_row)
'this gets a new row count for each iteration
temp_row = Worksheets("Summary").Cells(Rows.Count, 1).End(xlUp).Row
With Worksheets("Summary")
'this copy/pastes the templated range
.Range("A1:E7").Copy Range("A" & temp_row + 2)
'this inserts, from the master worksheet, the title
.Range("A" & temp_row + 2).Value = cell
End With
Next cell
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.