以下代码正常运行:它将一系列单元格从Sheet“GP Data”粘贴到“RAW”。代码的第一部分复制3x3的范围,后一代码复制4x4的范围。
早期代码执行时没有错误值,如下图所示。
然而,后一个代码执行所需的功能,但在粘贴数据后,总是在下一列中生成#N/A
的单元格。
arrData = Sheets("GP Data").Range("U12:U14").Value
Set rngwrite = Nothing
Set rngwrite = Sheets("DZ").Range("A:A").Find(strdate, LookIn:=xlFormulas)
Do While rngwrite Is Nothing
With Sheets("DZ").Range("A60000")
.End(xlUp).AutoFill (.End(xlUp).Resize(2))
End With
Set rngwrite = Sheets("DZ").Range("A:A").Find(CDate(strdate), LookIn:=xlFormulas)
Loop
rngwrite.Offset(, 1).Resize(, 3).Value = Application.Transpose(arrData)
arrData = Sheets("GP Data").Range("P12:R14").Value
'find get the first non-blank column in row 7 from right to left
Set rngwrite = Sheets("RAW").Range("IV7").End(xlToLeft).Offset(, 1)
'paste data
rngwrite.Resize(3, 3).Value = arrData
'drag dates across row 7
rngwrite.Offset(-1).Value = rngwrite.Offset(-1, -3).Value + 1
arrData = Sheets("GP Data").Range("U12:U15").Value
Set rngwrite = Nothing
Set rngwrite = Sheets("DZ").Range("A:A").Find(strdate, LookIn:=xlFormulas)
Do While rngwrite Is Nothing
With Sheets("DZ").Range("A60000")
.End(xlUp).AutoFill (.End(xlUp).Resize(2))
End With
Set rngwrite = Sheets("DZ").Range("A:A").Find(CDate(strdate), LookIn:=xlFormulas)
Loop
rngwrite.Offset(, 1).Resize(, 4).Value = Application.Transpose(arrData)
arrData = Sheets("GP Data").Range("P12:R15").Value
'find get the first non-blank column in row 7 from right to left
Set rngwrite = Sheets("RAW").Range("IV7").End(xlToLeft).Offset(, 1)
'paste data
rngwrite.Resize(4, 4).Value = arrData
'drag dates across row 7
rngwrite.Offset(-1).Value = rngwrite.Offset(-1, -3).Value + 1