Copy row if a range of column matches a value
Solved/Closed
Related:
- Excel copy row if cell contains
- Excel add 1 if cell contains text ✓ - Excel Forum
- Saints row 2 cheats - Guide
- Excel mod apk for pc - Download - Spreadsheets
- Conditional formatting if cell contains text ✓ - Excel Forum
- Excel cell color formula - Guide
7 responses
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