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 Contributor Last seen December 27, 2022 - Aug 18, 2011 at 10:43 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Contributor 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
- Protect pdf from copying - Guide
- How to delete a row in a table in word - Guide
- How to insert rows in excel automatically based on cell value without vba ✓ - Excel Forum
- Based on the values in cells b77 b81 c77 - Excel Forum
1 response
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Contributor
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