ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find a Cell Value (Revised) (https://www.excelbanter.com/excel-programming/352590-find-cell-value-revised.html)

gabe

Find a Cell Value (Revised)
 
Hello,

I'm just trying to write code that will find a cell value from one sheet to
another. On Sheet1, I want say cell "B11" to be what I'm looking for(what
ever value that is in cell "B11" is the value that I'm looking to find on
Sheet2). On Sheet2, I need it to search through say range "C1:C5001" and have
it select the first one it finds. How would I go about doing that?

Thanks


Dick Kusleika[_4_]

Find a Cell Value (Revised)
 
Gabe wrote:
I'm just trying to write code that will find a cell value from one
sheet to another. On Sheet1, I want say cell "B11" to be what I'm
looking for(what ever value that is in cell "B11" is the value that
I'm looking to find on Sheet2). On Sheet2, I need it to search
through say range "C1:C5001" and have it select the first one it
finds. How would I go about doing that?


Gabe:

dim rFound as Range

Set rFound = sheet2.Range("C1:C5001").Find(Sheet1.Range("B11"). Value)

If Not rFound Is Nothing Then
Debug.Print rFound.Address
End If

See http://www.dicks-blog.com/archives/2...e-find-method/ for more
on Find.

--
Dick Kusleika
MVP-Excel
www.dailydoseofexcel.com




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

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