vba - Stuck on 'Case' assignment/wording -
much have received on forum particular code; thought had there must beg assistance 1 again. think best explanation can give below in pseudo-code! once case selection portion done repeat same process through months have change referenced cells.
sub popcol() range("d3:d19").formula = "=rc[-1]-rc[-2]" 'd=c-b , delta equal cap minus dem = 3 19 range("d" & i) = clng(range("c" & i) - range("b" & i)) if (range("d" & i) < 0) range("e" & i) = range("e" & i) - range("d" & i) else range("f" & i) = range("f" & i) + range("d" & i) end if next range("g3:g19").formula = "=rc[-1]-rc[-2]" 'g=f-e , delta equal cap minus dem 'if delta (h)= capacity (g) continue, if g<0 go on prior months negative , add capacity 'then recalculate, else g>0 - go on prior months , subtract(a neg) demand (same adding absolute value). recalculate all. = 3 19 range("g" & i) = clng(range("f" & i) - range("e" & i)) select case (range("g" & i)) 'may 'case "g" = range ("f" & i) continue case = range("f" & i) goto line 35 'case "g" < "0" check d if >0,("d"&i)=("d"&i)-("g" & i) '{then compare d c, balance on equal placed in g , d & c end equal. goto beginning of sub} case < "0" ("d"&i)=("d"&i)-("g" & i)else goto line 5 case else 'case "g" > "0" check d if <0,("c"&i)=("c"&i)-("g" & i) "(then compare d c, balance on equal placed in g , d & c end equal.goto beginning of sub} if range("g" & i) > "0" end select 'next june = 3 19 range("j" & i) = clng(range("i" & i) - range("h" & i)) select case "june" 'case "h" = range ("f" & i) continue 'case "h" < "0" check g if >0,("g"&i)=("g"&i)-("j" & i) {then compare g f, balance on equal placed in j , g & f end equal. goto beginning of sub} 'case "h" > "0" check g if <0,("f"&i)=("f"&i)-("j" & i) (then compare g f, balance on equal placed in j , g & f end equal. goto beginning of sub} end select next 'continue on july, august, sept, oct, nov, dec, jan 14, feb 14 in feb 14 place balance on equal in end sub
thank soooo much!
your question hard understand. have posted example of code should resemble , can fill in blanks.
for = 3 19 range("g" & i).value = clng(range("f" & i).value) - clng(range("e" & i).value) select case clng((range("g" & i)).value) case clng(range("f" & i).value) goto line 35 case < "0" '("d"&i)=("d"&i)-("g" & i)else goto line 5 <--- wrong, use 2nd see reformat line. case else goto line 35 end select next
Comments
Post a Comment