Copying a row based on part of a field
Solved/Closed
Erenagh
-
18 Aug 2011 à 07:07
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 18 Aug 2011 à 10:43
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 18 Aug 2011 à 10:43
Related:
- Copying a row based on part of a field
- Saints row 2 cheats - Guide
- How to delete a row in word - Guide
- Protect pdf from copying - Guide
- Based on the values in cells b77 ✓ - Excel Forum
- Windows mobile-based device - Download - File management
1 response
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
18 Aug 2011 à 10:43
18 Aug 2011 à 10:43
Hi Erenagh,
You didn't specify the destination for the copied rows. In the below code I copied them to sheet2 in the first available cell of column A.
Here is the code:
Best regards,
Trowa
You didn't specify the destination for the copied rows. In the below code I copied them to sheet2 in the first available cell of column A.
Here is the code:
Sub Test()
Dim lRow As Integer
lRow = Sheets("Sheet1").Range("E" & Rows.Count).End(xlUp).Row
Set MR = Sheets("Sheet1").Range("E1:E" & lRow)
For Each Cell In MR
If (InStr(1, Cell.Value, "X") > 0) Or (InStr(1, Cell.Value, "1Y") > 0) Then
Cell.EntireRow.Copy
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial
End If
Next
Application.CutCopyMode = False
End Sub
Best regards,
Trowa