Вы находитесь на странице: 1из 1

MACRO EXCEL VBA BUSQUEDA EN MULTIPLES COLUMNAS

Public Function FindInRange(Val As Variant, LookIn As Range, ColIndexNumber As Integer) As


Range

' INPUTS:
' Val
' Range

= The Value you're looking for in your Range of cells


= The range of cells you're searching through

' ColIndexNumber = The index of the column you want a value returned from within the row
from which the value is found

' NOTE:
' This will only pull the first value matching your "Val" argument

Dim FoundCell As Range

Set FoundCell = LookIn.Find(what:=Val, LookAt:=xlWhole)

If FoundCell Is Nothing Then


Set FindInRange = Nothing
Else
Set FindInRange = Intersect(LookIn.Columns(ColIndexNumber), FoundCell.EntireRow)
End If

End Function

Вам также может понравиться