SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function CalcTarget1(range_data As Range, other_range As Range, weeksOut As Integer)
  2.  
  3.     Dim cell As Range
  4.     Dim col As Range
  5.     Dim c As Range
  6.  
  7.     Dim count As Double
  8.     Dim sum As Double
  9.     Dim box As Double
  10.  
  11.     For Each cell In range_data
  12.         If cell.Style = "Style 1" Then
  13.             count = count + 1
  14.         End If
  15.     Next cell
  16.  
  17.     If count > 0 Then
  18.         sum = 100 / count
  19.     Else
  20.         sum = 0
  21.     End If
  22.  
  23.     For Each col In range_data
  24.             If col.Value > weeksOut Then
  25.                 For Each c In other_range
  26.                     If c.Style = "Style 1" Then
  27.                           box = box + 1
  28.                      End If
  29.                 Next c
  30.         End If
  31.     Next col
  32.  
  33.     CalcTarget1 = Round(sum, 1) * box & "%"
  34.  
  35. End Function
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top