Copy row to next available row in another wb

Closed
cacaip89 - Mar 6, 2011 at 10:39 PM
 cacaip89 - Mar 7, 2011 at 11:22 AM
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!!




Related:

2 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Mar 7, 2011 at 01:01 AM
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
0
Hi venkat1926,

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

Can you help?

Thanks.
0