1

我首先想将所有行从表 evaluatierooster_NL 复制到表 evaluatierooster_NLFR。然后我想将工作表 evaluatierooster_FR 中的所有行(第一行除外)附加到工作表 evaluatierooster_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
4

2 回答 2

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)
于 2013-03-27T17:16:40.760 回答
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

应该这样做。

于 2013-03-27T12:47:19.217 回答