【发布时间】:2013-10-22 20:01:18
【问题描述】:
我正在尝试将数据从工作簿中的一个工作表复制到另一个工作表(名称为“Sheet1”和“清理数据”)。 rRow 是 Sheet1 中的源范围,而 rPaste 是我要在“清理数据”中复制到的位置。首先,新行应该有变量 sSkillset 和 sDate,它们目前工作正常,但随后它应该附加来自 rRow 的整行数据。我找不到不产生不匹配或对象错误的方法。
rPaste.Value = sSkillset
Set rPaste = rPaste.Offset(0, 1)
rPaste.Value = sDate
Set rPaste = rPaste.Offset(0, 1)
For Each rCell In rRow
'Copy rCell contents to rPaste
Set rPaste = rPaste.Offset(0, 1)
Next rCell
Set rPaste = rPaste.Offset(1, -14) 'I need a line so that next time rPaste is called, it is ready at column A of the next row
输出应该是一行: [sSkillset][sDate][rRowCell1][rRowCell2].....
谢谢!
【问题讨论】:
标签: excel vba copy offset worksheet