Find Row where Col is x and Val is y

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,953
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I'm trying this
frow = .Cells.Find(What:=x.Col, _
After:=.Cells(1, KeyCol), _
lookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False).Row

But getting Object doesn't support....

I'm wanting the the row number where Col KeyCol contains x.Col
There's only one instance of x.Col in the column.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Aah, apologies, Assumed the problem was with .Find but I was using x.Col when it should have been x.Column
So the above is working but I changed to this (seemed a bit simpler)
Set Found = .Columns(KeyCol).Find(what:=x.Column, lookIn:=xlValues, LookAt:=xlWhole)
If Not Found Is Nothing Then frow = Found.Row

The complete answer is the value in that row, in the Next column. KeyCol+1
Can that all be factored into the Find ?
Thanks.
 
Upvote 0
If I understand your question, this will return the value from the cell that is one column to the right of the Found cell

VBA Code:
If Not Found Is Nothing Then MyValue = Found.Offset(0, 1).Value
 
Upvote 0
Solution
Yes it worked perfectly and much tidier than I had,
Thanks
 
Upvote 0

Forum statistics

Threads
1,221,417
Messages
6,159,789
Members
451,589
Latest member
Harold14

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