VBA

Function 조회범위에서 해당 값을 찾고 Offset위치 값을 반환

NicSub 2019. 3. 21. 11:32
728x90
반응형

Function Find_Sch(values As String, ranges As range)

    Dim FindString As String
    Dim Rng As range
    FindString = values
    If Trim(FindString) <> "" Then
        With ranges
            Set Rng = .Find(What:=FindString, _
                            After:=.Cells(.Cells.Count), _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
            If Not Rng Is Nothing Then
'                Application.Goto Rng, True
'               ' Sheet1.Cells(8, 1).Select
'                ActiveCell.Offset(0, 8).Value = values
            Find_Sch = ActiveCell.Offset(0, 7).Value
            Else
               ' MsgBox "Nothing found"
             '  Find_Sheet1 = Null
            End If
        End With
    End If
End Function

반응형