我首先要将工作表evaluateatierooster_NL中的所有行复制到工作表evaluateatierooster_NLFR。然后我想将工作表evaluateatierooster_FR的所有行(第一行除外)附加到工作表evaluateatierooster_NLFR。我在下面的行上遇到错误,该对象丢失了?
LastRow = ActiveSheet.Cells.Find(What:="*", After:=evaluatierooster_NLFR.Range("A1"), _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
'~~> Copy evaluatierooster_NL to evaluatierooster_NLFR
Sheets("evaluatierooster_NL").Select
Rows("1:" & Rows.Count).Copy
Sheets("evaluatierooster_NLFR").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("evaluatierooster_FR").Select
Rows("2:" & Rows.Count).Copy
Sheets("evaluatierooster_NLFR").Select
Dim LastRow As Long
Set LastRow = ActiveSheet.Cells.Find(What:="*", After:=evaluatierooster_NLFR.Range("A1"), _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
ActiveSheet.Cells(LastRow, 1).Paste
答案 0 :(得分:0)
尝试以下方法:
'~~> Copy evaluatierooster_NL to evaluatierooster_NLFR
Dim LastRow As Long
Sheets("evaluatierooster_NL").Select
Rows("1:" & Rows.Count).Copy
Sheets("evaluatierooster_NLFR").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("evaluatierooster_FR").Select
Rows("2:" & Rows.Count).Copy
Sheets("evaluatierooster_NLFR").Select
' get the last row (same as doing CTRL+Up keystroke in Excel)
LastRow = activesheet.range("A65536").end(xlup).row+1
ActiveSheet.Cells(LastRow, 1).Paste
应该这样做。
答案 1 :(得分:0)
尝试以下代码。
Dim lastRow As Long
lastRow = Sheets("evaluatierooster_NL").Range("A65000").End(xlUp).Row
Sheets("evaluatierooster_NL").Rows("1:" & lastRow).Copy Sheets("evaluatierooster_NLFR").Range("A1")
lastRow = Sheets("evaluatierooster_FR").Range("A65000").End(xlUp).Row
Sheets("evaluatierooster_FR").Rows("2:" & lastRow).Copy Sheets("evaluatierooster_NLFR").Range("A65000").End(xlUp).Offset(1, 0)