leeksleeks
Board Regular
- Joined
- Oct 31, 2013
- Messages
- 96
Hi,
I have been looking for some code to find a row within "Sheet1" containing a word with a question mark next to it and then copy that row and the row above to the next worksheet "Sheet2". I have tried other peoples codes but they dont incorporate finding part of a word. Below is the code I have been trying but I cannot get this to find the questionmark attached to the word. Also this code doesnt copy the row above either. Any help with this would be greatly appreciated.
I have been looking for some code to find a row within "Sheet1" containing a word with a question mark next to it and then copy that row and the row above to the next worksheet "Sheet2". I have tried other peoples codes but they dont incorporate finding part of a word. Below is the code I have been trying but I cannot get this to find the questionmark attached to the word. Also this code doesnt copy the row above either. Any help with this would be greatly appreciated.
Code:
Sub CopyRows() Dim bottomL As Integer
bottomL = Sheets("Sheet1").Range("L" & Rows.Count).End(xlUp).Row
Dim c As Range
For Each c In Sheets("Sheet1").Range("A1:Z170" & bottomL)
If c.Value = "*?" Then
c.EntireRow.Copy Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next c
End Sub