Copy row to next available row in another wb

[Closed]
Report
-
 cacaip89 -
Hello,

I am trying to copy row to next available row in another wookbook. I have the follow codes, but not sure why it skips 3 rows every time, then the new data to be copied on the workbook.

Dim nxtRw As Integer

'Determine next empty row in log.xls
nxtRw = Workbooks("Tooling Master Sheet.xlsx").Sheets("Sheet1").Range("C" & Rows.Count).End(xlUp).Row + 1
'Copy Activeworkbook row to to log.xls
With ws
Set rngToCopy = .Range("C6", "N25")
End With

With rngToCopy
Set rngToPaste = wkb.Sheets("Sheet1").Range("C4").Rows(nxtRw).Resize(.Rows.Count, .Columns.Count)

End With

rngToPaste.Value = rngToCopy.Value
Application.CutCopyMode = False


Please help! Thank you!!




2 replies

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
802
quote
nxtRw = Workbooks("Tooling Master Sheet.xlsx").Sheets("Sheet1").Range("C" & Rows.Count).End(xlUp).Row + 1

rows shod come first and columns later

it should be
range(rows.count,"C").end(xlup).row+1
Hi venkat1926,

I got an error message said Application-defined or object-defined error after I replaced your code.

Can you help?

Thanks.