LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default help plz in sorting out the error in problem

getting error ==== Run Time Error"13"..
Mismatch..

hi everyone here is my code i m getting error [Run Time Error"13"..
Mismatch..] while exceuting this code

dont knw wats wrong

i m trying to caculate are under curve for "3" points if i enter (have
data set of around 1095 points)

j = 1 to 1092 then its working fine
but i want to mak this programe running for any data set
plz suggest to mak this code "more flexible to use"

Sub Button1_Click()

RowcountA = Cells(Rows.Count, "a").End(xlUp).Row


For j = 1 To RowcountA Step 3

x0 = Cells(j + 2, "a").Value
xn = Cells(j + 4, "a").Value

Cells(j + 2, "g").Value = x0
Cells(j + 2, "h").Value = xn

Cells(j + 2, "D").Select
ActiveCell.FormulaR1C1 = _
"=INDEX(LINEST(RC[-2]:R[2]C[-2],RC[-3]:R[2]C[-3]^{1,2}),1)"
Cells(j + 2, "E").Select
ActiveCell.FormulaR1C1 = _
"=INDEX(LINEST(RC[-3]:R[2]C[-3],RC[-4]:R[2]C[-4]^{1,2}),1,2)"
Cells(j + 2, "F").Select
ActiveCell.FormulaR1C1 = _
"=INDEX(LINEST(RC[-4]:R[2]C[-4],RC[-5]:R[2]C[-5]^{1,2}),1,3)"

p = Cells(j + 2, "d").Value
q = Cells(j + 2, "e").Value
r = Cells(j + 2, "f").Value

m = 100
n = m / 2
D = (xn - x0) / m

x = x0
y = p * x ^ 2 + q * x + r
Integ = y
Range("h4") = xn
x = xn
y = p * x ^ 2 + q * x + r
Integ = Integ + y

'[2] This loop adds terms 4*(y(1)+y(3)+ ... + y(2*n-1))
For i = 1 To 2 * n - 1 Step 2
x = x0 + i * D
y = p * x ^ 2 + q * x + r
Integ = Integ + 4 * y
Next i
'[3] This loop adds tersm 2*(y(2)+y(4)+...+y(2*n-2))
For i = 2 To 2 * n - 2 Step 2
x = x0 + i * D
y = p * x ^ 2 + q * x + r
Integ = Integ + 2 * y
Next i
'[4] The sum contained in "Integ" is now multiplied by Dx/3 to
finish calculation
Integ = Integ * D / 3
Cells(j + 2, "k") = Integ

' code to average depths

'Cells(j + 2, "L").Select
'ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-9]:R[2]C[-9])"

' code to get volume

' Cells(j + 2, "m").Select
' ActiveCell.FormulaR1C1 = "=PRODUCT(RC[-2],RC[-1])"

Next j


End Sub

many thanx in advance

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Sorting Error Scott Halper Excel Worksheet Functions 1 March 19th 08 01:27 PM
Sorting error Daminc Excel Discussion (Misc queries) 4 April 11th 06 11:39 AM
sorting error ananga Excel Discussion (Misc queries) 2 June 30th 05 04:21 PM
error in sorting hans[_3_] Excel Programming 1 April 22nd 04 11:09 AM


All times are GMT +1. The time now is 12:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"