ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting the cell that a vlookup or match function references (https://www.excelbanter.com/excel-programming/369054-selecting-cell-vlookup-match-function-references.html)

Elceller in distress[_2_]

selecting the cell that a vlookup or match function references
 
I would like to use vlookup or match to find a record in a database. Once
vlookup or match finds it, I would like to select the whole row. Is this
possible?

Jim Thomlinson

selecting the cell that a vlookup or match function references
 
You can give this a try... It searches all of the cells on a sheet. We can
narrow that down to a column or such if you need...

Sub FindRow()
Dim rngFound As Range

Set rngFound = Cells.Find(What:="This", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry ""This"" was not found"
Else
rngFound.EntireRow.Select
End If
End Sub
--
HTH...

Jim Thomlinson


"Elceller in distress" wrote:

I would like to use vlookup or match to find a record in a database. Once
vlookup or match finds it, I would like to select the whole row. Is this
possible?


Elceller in distress[_2_]

selecting the cell that a vlookup or match function reference
 
Can I make it just search in one colum and then select the row of the search
result. In other words, I only want it to find matches in colum L, then
select the entire row associated with that key word.

"Jim Thomlinson" wrote:

You can give this a try... It searches all of the cells on a sheet. We can
narrow that down to a column or such if you need...

Sub FindRow()
Dim rngFound As Range

Set rngFound = Cells.Find(What:="This", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry ""This"" was not found"
Else
rngFound.EntireRow.Select
End If
End Sub
--
HTH...

Jim Thomlinson


"Elceller in distress" wrote:

I would like to use vlookup or match to find a record in a database. Once
vlookup or match finds it, I would like to select the whole row. Is this
possible?


Dave Peterson

selecting the cell that a vlookup or match function reference
 
Something like:

Sub FindRow()
Dim rngFound As Range

Set rngFound = range("L:L").Cells.Find(What:="This", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry ""This"" was not found"
Else
rngFound.EntireRow.Select
End If
End Sub

But the code already selects the whole row where it was found.



Elceller in distress wrote:

Can I make it just search in one colum and then select the row of the search
result. In other words, I only want it to find matches in colum L, then
select the entire row associated with that key word.

"Jim Thomlinson" wrote:

You can give this a try... It searches all of the cells on a sheet. We can
narrow that down to a column or such if you need...

Sub FindRow()
Dim rngFound As Range

Set rngFound = Cells.Find(What:="This", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry ""This"" was not found"
Else
rngFound.EntireRow.Select
End If
End Sub
--
HTH...

Jim Thomlinson


"Elceller in distress" wrote:

I would like to use vlookup or match to find a record in a database. Once
vlookup or match finds it, I would like to select the whole row. Is this
possible?


--

Dave Peterson


All times are GMT +1. The time now is 01:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com