Find a value with a given condition(VBA FIND)

JST013

Board Regular
Joined
Mar 11, 2015
Messages
74
So I am trying to use .find() to to locate a string and write an adjacent string on a different worksheet if a cell adjacent to the string meets a criteria. If I find a string and the cell meets the criteria I am done at that point. I don't need to look any further.

mouthful...


this is what I have so far....


Code:
dim ws as worksheet
set ws = thisworkbook.sheets("Sheet1")
for each thing in [Table[Column 1]][INDENT]With thing

[/INDENT]
[INDENT=2]set found = .cells.find(what:=thing)

If Not found Is Nothing

[/INDENT]
[INDENT=3]Do Until found Is Nothing

[/INDENT]
[INDENT=4]frow = found.Row
fcol = found.Column
gotcha = ws.Cells(foundrow, 2)

**********
[/INDENT]
[INDENT=3]Loop

[/INDENT]
[INDENT=2]End If

[/INDENT]
[INDENT]End With

[/INDENT]
next thing







so gotcha is my adjacent string...in the next column over is where I want to test the criteria...

Not sure how to go about setting my criteria... if ws.cells(foundrow,3) <> meet critera...then what can I do to keep searching?

also...if i wanted the search to start at the bottom of the list...am I doing this correctly?

Thank you I know I'm very confusing...infact I confuse myself
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi,
you need to use FindNext Method - a working example can be found in your VBA Helpfile under "FindNext"

Dave
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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