我可以用这些方法完成这项工作有几个小时。
我尝试在循环中使用Offset,但我没有让它工作 例如,我使用x = x.Offset(10,0)和i = i.Offset(5,0)等。
Sub Macro5()
Dim i As Range, j As Range, k As Range
Dim x As Range, y As Range
Dim Num As Integer
Num = 94
Set x = Sheets("Sum Data").Range("B1:G10")
Set j = Sheets("PNA Physical Needs Summary Data").Range("C4:L9")
Set i = Sheets("PNA Physical Needs Summary Data").Range("B4:B9")
Set k = Sheets("Sum Data").Range("A1")
Set p = Sheets("PNA Physical Needs Summary Data").Range("P3:P8")
Set e = Sheets("PNA Physical Needs Summary Data").Range("A4:A9")
Do
x.Copy
j.Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
p.Copy i
k.Copy e
Num = Num - 1
Loop Until Num = 0
End Sub
答案 0 :(得分:0)
我不明白你要做什么,但是当前例程成功地将数据从一组范围复制到另一组范围。
您是否从语句中省略了设置以更新x和i?以下似乎可以按预期工作
Set x = x.Offset(10,0)
Set i = i.Offset(5,0)
如果遗漏Set
不是您的问题,请扩展您的问题以包含您的完整代码以及您遇到的失败的性质。