Copy row if a range of column matches a value
Solved/Closed
Related:
- Vba copy row to another sheet
- Google sheet right to left - Guide
- Vba case like - Guide
- Saints row 2 cheats - Guide
- Windows network commands cheat sheet - Guide
- Little alchemy cheat sheet - Guide
7 responses
tompols
Posts
1273
Registration date
Wednesday July 28, 2004
Status
Contributor
Last seen
November 25, 2013
28
Jan 15, 2010 at 02:18 AM
Jan 15, 2010 at 02:18 AM
Hi,
the first code I wrote was looking for cells having the exact same value as the entered string.
here's an update that looks for cells containing the string:
the first code I wrote was looking for cells having the exact same value as the entered string.
here's an update that looks for cells containing the string:
Sub customcopy() Dim strsearch As String, lastline As Integer, tocopy As Integer strsearch = CStr(InputBox("enter the string to search for")) lastline = Range("A65536").End(xlUp).Row j = 1 For I = 1 To lastline For Each c In Range("B" & I & ":Z" & i) If InStr(c.Text, strsearch) Then tocopy = 1 End If Next c If tocopy = 1 Then Rows(i).Copy Destination:=Sheets(2).Rows(j) j = j + 1 End If tocopy = 0 Next i End Sub