Vba: check string and copy corresponding values

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
470
Hello everybody.

I've a situation like this: I've to find the string in cell A2 ("C57") in column F (the recurrences could be 0 or 1), and then copy the values INFO 1, INFO 2 and INFO 3.

In this case:
B2 EEE
C2 CCC
D2 AAA

https://imgur.com/a/IW3vL

I've tried with INSTRING and VLOOKUP, but unsuccessfully.

Could you indicate the right way?
 
Last edited:

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
9,562
Try:
Code:
Sub FindVal()
    Dim foundVal As Range
    Set foundVal = Range("F:F").Find(Range("A2"), LookIn:=xlValues, lookat:=xlPart)
    If Not foundVal Is Nothing Then
        foundVal.Offset(0, 1).Resize(, 3).Copy Range("B2")
    End If
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,005
Messages
5,526,232
Members
409,689
Latest member
martin_br

This Week's Hot Topics

Top