Extract data containing

Godders199

Active Member
Joined
Mar 2, 2017
Messages
313
Office Version
  1. 2013
Hello, i have written the following which i hoped would extract the relevant rows for me, however it currently returns no results.


Sub Test()
For Each Cell In Sheets("submission report").Range("bd:bm")
If Cell.Value = Sheets("instructions").Range("a8") Then
matchRow = Cell.Row
Rows(matchRow & ":" & matchRow).Select
Selection.Copy
Sheets("Results").Select
ActiveSheet.Rows(matchRow).Select
ActiveSheet.Paste
Sheets("Instructions").Select
End If
Next
End Sub

Effectively i want it to look at columns BD:BM, if the word contained in "Sheets("instructions").Range("a8")" then copy and paste the row to the results tab.

Think the issue might be that the cells contain more than one word , so it is currently only looking for an extact match. I have tried putting ** around A8 but this still does not make any difference.

Grateful if someone can tell me what i am doing wrong.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You said:
Range("bd:bm")

Do you really need to check that many cells.
That's 10 columns which each have 1.5 million rows?
 
Upvote 0
the work sheet normally contains 2000 rows so i can restrict it to look just at the first 2000 rows,
 
Upvote 0
Try this:
I assume your sheet is named
Instructions
Please check script for proper sheet names.
Capitalization is important.
One place you said instructions another place you said Instructions
Same with all sheet names

Code:
Sub Find_Me()
'Modified 3-5-18 6:31 AM EST
Dim SearchString As String
Dim SearchRange As Range
SearchString = Sheets("Instructions").Range("a8").Value
Set SearchRange = Sheets("submission report").Range("bd:bm").Find(SearchString, LookIn:=xlValues, lookat:=xlWhole)
If SearchRange Is Nothing Then MsgBox SearchString & "  Was not found": Exit Sub
Sheets("submission report").Rows(ans).Copy Sheets("Results").Rows(ans)
Sheets("Instructions").Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top