ciao a tutti, ho questo codice:

codice:
dim p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,par
p1=30
p2=60
p3=90
p4=120
p5=150
p6=180
p7=210
p8=240
p9=270
p10=300

if tot <= p1 then
par = p1-tot
elseif tot > p1 AND tot <= p2 then
par = p2-tot
elseif tot > p2 AND tot <= p3 then
par = p3-tot
elseif tot > p3 AND tot <= p4 then
par = p4-tot
elseif tot > p4 AND tot <= p5 then
par = p5-tot
elseif tot > p5 AND tot <= p6 then
par = p6-tot
elseif tot > p6 AND tot <= p7 then
par = p7-tot
elseif tot > p7 AND tot <= p8 then
par = p8-tot
elseif tot > p8 AND tot <= p9 then
par = p9-tot
elseif tot > p9 AND tot <= p10 then
par = p10-tot


end if
con questo, trovo la differenza tra TOT e P(n) cioè PAR

il problema è che non sapendo quanto è TOT, che potrebbe essere molto superiore a 300, come posso fare per semplificarmi la vita senza scrivere infinitamente il codice?

grazie.