Vincent paul
New Member
- Joined
- Oct 8, 2014
- Messages
- 22
Hi,
Im just started to learn macros.
In below code why tempindex assigend as 1 and what is difference between exit function and end function.
Function EGLookup(SearchRange As Range, SearchValue As String, RetreiveRange As Range)
Dim TempIndex As Double
TempIndex = 1
For Each cell In SearchRange
If CStr(LCase(cell.Value)) = CStr(LCase(SearchValue)) Then
EGLookup = RetreiveRange.Rows(TempIndex).Value
Exit Function
End If
TempIndex = TempIndex + 1
Next
End Function
Im just started to learn macros.
In below code why tempindex assigend as 1 and what is difference between exit function and end function.
Function EGLookup(SearchRange As Range, SearchValue As String, RetreiveRange As Range)
Dim TempIndex As Double
TempIndex = 1
For Each cell In SearchRange
If CStr(LCase(cell.Value)) = CStr(LCase(SearchValue)) Then
EGLookup = RetreiveRange.Rows(TempIndex).Value
Exit Function
End If
TempIndex = TempIndex + 1
Next
End Function