Code :
Sub CalculRimp() 'création de mes 2 tableaux Dim max As Double Dim tabt(10000), tabq(10000) As Double Dim w As Integer max = Workbooks("Outil.xls" ).Sheets("1" ).Cells(12, 8).Value For w = 9 To max tabt(w) = Workbooks("Outilxls" ).Sheets("1" ).Cells(w, 3) tabq(w) = Workbooks("Outil.xls" ).Sheets("1" ).Cells(w, 4) Next w dim n, i as Integer n=1000 for i=1 to n c_courant = concentration(tabt(), tabq()) next i End Sub Public Function concentration(ByRef tab1() As Double, ByRef tab2() As Double) As Double max = Workbooks("Outil.xls" ).Sheets("1" ).Cells(12, 8).Value dim Cq as double dim tot as double tot=0 dim q as integer for q=1 to max Cq=tab1(q)*tab2(q) tot=tot+Cq next q concentration=tot End Function
|