Copy row if a range of column matches a value
Solved/Closed
Related:
- Excel vba copy row if cell value matches
- How to enable vba in excel - Guide
- Number to words in excel without vba - Guide
- Excel conditional formatting if another cell contains specific text ✓ - Excel Forum
- If cell contains (multiple text criteria) then return (corresponding text criteria) ✓ - Excel Forum
- If cell contains specific text then return value in another cell vba ✓ - Excel Forum
7 replies
tompols
Posts
1219
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