Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.97 KB | None | 0 0
  1. Function FilterOrSomethingLikeThat(surname as String, course as String)
  2.  
  3. Dim iStartRow As Integer = 2
  4. Dim iStopRow As Integer = 65535
  5. Dim sStopCriteria As String = ""
  6. Dim sStopCriteriaField as String = "A"
  7. Dim sValueField As String
  8. Dim sSurnameField As String
  9. dim sCourseField As String
  10.  
  11. iStartRow = 2 ' Where to start the search
  12. iStopRow = 65535 ' Where to stop the search
  13. sStopCriteria = "" ' When to stop if
  14. sStopCriteriaField = "A" ' this field equals sStopCriteria
  15. sSurnameField = "B" ' Where the surname is in
  16. sCourseField = "C" ' Where the course is in
  17. sValueField = "D" ' Where the value you want is in
  18.  
  19. Dim i as Integer
  20. For i = iStartRow To iStopRow
  21.     If Range(sStopCriteriaField&i).Value = sStopCriteria Then Exit For
  22.  
  23.     If Range(sSurnameField&i).Value = surname AND Range(sCourseField&i).Value = course Then
  24.         FilterOrSomethingLikeThat = Range(sValueField&i).Value
  25.         Exit Function
  26.     End If
  27. Next
  28.  
  29. FilterOrSomethingLikeThat = "Not Found :("
  30.  
  31. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement