Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. Public Function PersonOfInterest()
  2. Dim v As Variant, nam As String
  3. Application.Volatile
  4. nam = Sheet1.Name
  5. v = Sheet1.Range("J28").Value
  6. For i = 2 To 8
  7. v2 = Sheets(i).Range("J28").Value
  8. If v2 > v Then
  9. v = v2
  10. nam = Sheets(i).Name
  11. End If
  12. Next i
  13.  
  14. PersonOfInterest = nam
  15. End Function
  16.  
  17. Public Function PersonsOfInterest()
  18. Dim v As Variant, nam As String
  19. Dim i As Long, v2 As Variant
  20. Application.Volatile
  21. nam = Sheet1.Name
  22. v = Sheet1.Range("J28").Value
  23. For i = 2 To 8
  24. v2 = Sheets(i).Range("J28").Value
  25. If v2 > v Then
  26. v = v2
  27. End If
  28. Next i
  29.  
  30. PersonsOfInterest = ""
  31. For i = 1 To 8
  32. If Sheets(i).Range("J28").Value = v Then
  33. If PersonsOfInterest = "" Then
  34. PersonsOfInterest = Sheets(i).Name
  35. Else
  36. PersonsOfInterest = PersonsOfInterest & ", " & Sheets(i).Name
  37. End If
  38. End If
  39. Next i
  40. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement