엑셀VBA

find함수에서 lookin:=xlformulas와 xlvaues의 차이점

조용문 2012. 12. 28. 08:55

lookin:=xlformulas    << 수식에서
lookin:=xlvaues    << 값에서
LookIn:=xlComments    << 메모에서

위 사진에서 찿는 위치를 메모로 하고 메크로 기록을 하면...

    Cells.Find(What:="홍길동", After:=ActiveCell, LookIn:=xlComments, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
        , MatchByte:=False, SearchFormat:=False).Activate

이렇게 기록 되지만...

실제 사용하는 건 보통 아래 코드를 많이 사용 합니다. xlvaues 는 보통 생략

Set rngA = Cells.Find(what:="홍길", lookat:=xlPart)    '// 포함된 셀을 찿음

Set rngA = Cells.Find(what:="홍길동", lookat:=xlWhole)   '// 내용이 정확히 일치하는 셀을 찿음

하지만 수식이나, 메모에서 찿고자 한다면 지정해 주어야 합니다.