Guest User

Untitled

a guest
Apr 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. REM ***** BASIC *****
  2.  
  3. public Function calcprice(rCell) as single
  4.  
  5. Dim vArray() As Variant
  6.  
  7. Dim n As Long
  8.  
  9. Dim price as single
  10.  
  11. Dim searchrange As Range
  12.  
  13. Dim resultrange As Range
  14.  
  15.  
  16. Set searchrange = Sheets("channels").Range("a2:a89")
  17.  
  18. Set resultrange = Sheets("channels").Range("f2:f89")
  19.  
  20. vArray() = Split(rCell, ",")
  21.  
  22. price = 0
  23.  
  24. for n=0 to uBound(vArray())
  25.  
  26. price = price + Application.LOOKUP(vArray(n),searchrange,resultrange)
  27.  
  28. next n
  29.  
  30.  
  31. calcprice = price
  32.  
  33. End function
Add Comment
Please, Sign In to add comment