i legend
Premium Member
Ciao a tutti ,...................Vorrei scrivere una funzione da inserire in una sub per lo sviluppo degli Elementi scritti in un InputBox. In un inputBox scrivo i numeri in "00" da (1) a (20 elementi) separati da un ".".............................. in un altro inputBox scelgo la Classe............................... ora in base alla classe sviluppo gli elementi......................................(So che tutto questo è presente in spaziometria, ma molte ricerche per ora per me è più semplice svilupparle in foglio di calcolo..non me ne voglia nessuno)... [Code ] 5 10 15 20 1 5 10 15 20 2 10 45 105 190 3 10 120 455 1140 4 5 210 1365 4845 5 1 252 3003 15504 [/code]
Spero che qualcuno possa aiutarmi, ...................................... il codice è errato, spero la logica seguita non lo sia............................................... Cordiali saluti.....................I Legend
Codice:
sub SviluppoClasse ' dichiaro le variabili Dim sNumeri as string, sD as string Dim Cl as integer Dim oCellSviluppo as object ' acquisisco gli elementi che mi occorre analizzare sNumeri=InputBox("Inserisci i Numeri di Ricerca in doppia cifra e separati dal "." ","Analesi Numerica") Cl=Cint(InputBox("Inserisci la classe di sviluppo, 1= estratto , 2= ambo,3=terno,ecc..","SviluppoClasse") ' il sistema sviluppato scorre nella cella oCellSviluppo.string=Carica(sNumeri , sD , Cl ) end sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' function Carica(sNumeri as string, Cl as integer) as string ' dichiaro le variabili che devo utilizzare.. Dim L_sNum as integer 'lunghezza della stringa Dim vetNum as string ' string senza separatori Dim x as integer,E as string,A as string,T as string,Q as string,C as string vetNum=split(sNumeri,".",2) L_sNum=Len(vetNum) redim aNum(0) for x =1 to L_sNum step 2 aNum= aNum(x) Select case Classe case 1 cl=1 carica=format(x,"00") case 2 cl= 2 for E= 1 to ubond(aNum(x))-2 for A= E+1 to Ubound(aNum(x))-1 carica= format(E,"00")&"."&format(A,"00") next a next e case 3 Cl=3 for E= 1 to ubond(aNum(x))-3 for A= E+1 to Ubound(aNum(x))-2 for t=a+1 to ubound(aNum(x))-1 carica= format(E,"00")&"."&format(A,"00")&"."& format(T,"00") next t next a next e case 4 cl=4 for E= 1 to ubond(aNum(x))-4 for A= E+1 to Ubound(aNum(x))-3 for t=a+1 to ubound(aNum(x))-2 for q=t+1 to ubound(aNum(x))-1 carica= format(E,"00")&"."&format(A,"00")&"."& format(T,"00")&"."&Format(Q,"00") next q next t next a next e case=5 Cl=5 for E= 1 to ubond(aNum(x))-5 for A= E+1 to Ubound(aNum(x))-4 for t=a+1 to ubound(aNum(x))-3 for q=t+1 to ubound(aNum(x))-2 for C=q+1 to ubound(aNum(x))-1 carica= format(E,"00")&"."&format(A,"00")&"."& format(T,"00")&"."&Format(Q,"00") &"."&format(C,"00") next C next q next t next a next e end select end function