SomethingB
SomethingB

Reputation: 1

vba find method doesnt work with cell with reference

I am trying to use the VBA Find method on a column that uses the Excel Concatenate function on two other columns. It doesn't seem to be able to find a value that is displayed using the concatenate function, as when I just write in a value it finds it no problem. I am fairly new to VBA, so I'm not sure if there is just some nuance to using the Find method with references I am not aware of. Edit:

CurrDevice = Range("B" & Target.Row)
CurrPort = Range("C" & Target.Row).Value
ConcatInfo = CurrDevice & CurrPort

Dim TargetRange As Range
Set TargetRange = Range("R:R").Find(ConcatInfo)

Upvotes: 0

Views: 144

Answers (1)

Hasib_Ibradzic
Hasib_Ibradzic

Reputation: 666

Without seeing the actual code you have, I assume the issue is that you are looking within the formula and not the value. If you add this code to your find function it should work:

 Find( What , After , LookIn , LookAt , SearchOrder , SearchDirection , MatchCase , MatchByte , SearchFormat )

For the LookIn portion use this: lookin:=xlValues

Upvotes: 1

Related Questions