code_junkie

lookup Data in Excel

Nov 11th, 2011
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. B104=MAX(($A$2:$A$101*100+$B$1:$CW$1<B103)*($B$2:$CW$101=TargetValue)*($A$2:$A$101*100+$B$1:$CW$1))
  2.  
  3. Dim arr As Range
  4. Dim tempval As Range
  5. Dim op As Integer
  6.  
  7. Set arr = Worksheets("sheet1").Range("b2:ao41")
  8. op = 1
  9. Range("B53:D153").ClearContents
  10.  
  11.  
  12.  
  13.  
  14.  
  15. For Each tempval In arr
  16. If Round(tempval.Value, 0) = Round(Range("b50").Value, 0) Then
  17.  
  18. Range("b52").Offset(op, 0).Value = Range("a" & tempval.Row).Value
  19. Range("b52").Offset(op, 1).Value = Cells(tempval.Column, 1).Value
  20. Range("b52").Offset(op, 2).Value = tempval.Value
  21. op = op + 1
  22.  
  23. End If
  24.  
  25. Next
  26. Range("b50").Select
Add Comment
Please, Sign In to add comment