Copy rows from another Excel-file
Solved/Closed
Related:
- Copy rows from another Excel-file
- How to open excel file in notepad - Guide
- How to copy data from one excel sheet to another - Guide
- Dvi file - Guide
- Excel mod apk for pc - Download - Spreadsheets
- Windows 10 iso file download 64-bit - Download - Windows
2 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Contributor
Last seen
December 27, 2022
555
Oct 21, 2010 at 10:27 AM
Oct 21, 2010 at 10:27 AM
Hi JeS,
Take a look at this code:
Please adjust the workbook, sheet and data range to suit you situation.
Note: both workbooks must be opened for the code to work.
Is this simple enough?
Best regards,
Trowa
Take a look at this code:
Sub test()
Set MyRange = Workbooks("jes data.xls").Sheets("blad1").Range("B1:B100")
For Each cell In MyRange
If cell.Value = 25 Or cell.Value = 34 Or cell.Value = 42 Then
cell.EntireRow.Copy
Workbooks("jes blank.xls").Sheets("Blad1").Activate
Range("B" & Rows.Count).End(xlUp).Offset(1, 0).EntireRow.PasteSpecial
End If
Next
Application.CutCopyMode = False
End Sub
Please adjust the workbook, sheet and data range to suit you situation.
Note: both workbooks must be opened for the code to work.
Is this simple enough?
Best regards,
Trowa
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Contributor
Last seen
December 27, 2022
555
Oct 26, 2010 at 09:01 AM
Oct 26, 2010 at 09:01 AM
Hi JeS,
Application.CutCopyMode = False is used to clear the Excel's memory.
When you don't use this, the last row that is copied remains in Excel's memory and can be copied again.
There is no penalty for not using this line, so feel free to run the code without this line. The easiest way to do this is to place a ' in front of the line to make it a comment and exclude it from the code.
Best regards,
Trowa
Application.CutCopyMode = False is used to clear the Excel's memory.
When you don't use this, the last row that is copied remains in Excel's memory and can be copied again.
There is no penalty for not using this line, so feel free to run the code without this line. The easiest way to do this is to place a ' in front of the line to make it a comment and exclude it from the code.
Best regards,
Trowa
Oct 22, 2010 at 04:43 AM