Find Row where Col is x and Val is y

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,061
Office Version
  1. 2019
  2. 2010
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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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

Forum statistics

Threads
1,223,705
Messages
6,173,996
Members
452,542
Latest member
Bricklin

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