Copying a row based on part of a field
Solved/Closed
Erenagh
-
Aug 18, 2011 at 07:07 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 18, 2011 at 10:43 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 18, 2011 at 10:43 AM
Related:
- Copying a row based on part of a field
- Saints row 2 cheats - Guide
- How to delete a row in a table in word - Guide
- Protect pdf from copying - Guide
- Macro to insert row in excel based on criteria ✓ - Excel Forum
- We couldn't find an account matching the login info you entered, but found an account that closely matches based on your login history. - Facebook Forum
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Aug 18, 2011 at 10:43 AM
Aug 18, 2011 at 10:43 AM
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