我需要一个宏来复制和粘贴多个工作表中的某些单元格(b5:d10)并将其粘贴到新的单个工作表中。只是我想要碰撞内容。谢谢提前
sub copyrange()
range("b5:d10).copy
range("e1").select
activesheet.paste
application.cutcopymode=false
endsub
我的代码不会复制所有工作表数据。请帮我复制并粘贴它
答案 0 :(得分:0)
Sub copyrange()
Dim rngTarget As Range, wksTemp As Worksheet
Set rngTarget = ThisWorkbook.Worksheets(1).Range("A2:C7")
For Each wksTemp In ActiveWorkbook.Worksheets
rngTarget.Value = wksTemp.Range("B5:D10").Value
Set rngTarget = rngTarget.Offset(6)
Next wksTemp
End Sub