find question on vba

M

moonhk

Hi All

I define two find
1. Find Key
2. Find Item

In find key, the cell formula is =G2&"|"&V3&"|"&J2. I check the data,
the find can not able to find a key value.
The key value is on target sheet. But the find return nothing.

What is the problem on data case return nothing ?


With GP_WK.Sheets(MES.SHT_Name).Range(MES.KEY_RANGE)
Set Rng_KEY = .Find(What:=GPD_KEY_VAL, _
After:=.Cells(1), _
LookIn:=xlValue, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
End With

With GP_WK.Sheets(MES.SHT_Name).Range(MES.ITEM_RANGE)
Set Rng_ITEM = .Find(What:=GPD_ITEM_VAL, _
After:=.Cells(1), _
LookIn:=xlValue, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
End With

If Not Rng_ITEM Is Nothing And Rng_KEY Is Nothing Then

......
 
O

OssieMac

I am assuming that GPD_KEY_VAL is a defined name of a cell. If so then try
the following.

Set Rng_KEY = .Find(What:=Range("GPD_KEY_VAL").Value, _
After:=.Cells(1), _
LookIn:=xlValue, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

Regards,

OssieMac


Regards,

Regards,

OssieMac
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top