Hi All,
I am writing a VBA code to calculate and track the corrosion defects in subsea pipelines the intention is to input the data from ROV scans and then do various mathematical calculations and then output them back into the excel spreadsheet.
When I run the code I get the following error.....
Error: Run type error '13' Type Mismatch
The debug says that the following line is defective.
'final calculation
ReDim Sfailurearray(1 To RowCount, 1 To ColCount)
For i = 1 To RowCount
For j = 1 To ColCount
Sfailurearray = FlowStress * (TopFailurearray(i, j) / BottomFailurearray(i, j))
Next j
Next i
Mathematically I have traced the "root-cause" of the problem back to the if function that is below.
ReDim RealDeptharray1(1 To RowCount, 1 To ColCount)
For i = 1 To RowCount
For j = 1 To ColCount
RealDeptharray1(i, j) = Deptharray(i, j) + ((accRel / 100) * (Deptharray(i, j)))
Next j
Next i
ReDim RealDeptharray2(1 To RowCount, 1 To ColCount)
For i = 1 To RowCount
For j = 1 To ColCount
RealDeptharray2(i, j) = Deptharray(i, j) + accAbs
Next j
Next i
ReDim RealDeptharray(1 To RowCount, 1 To ColCount)
For i = 1 To RowCount
For j = 1 To ColCount
If OptionButton6.Value = True Then
RealDeptharray(i, j) = RealDeptharray1(i, j)
End If
Next j
Next i
ReDim RealDeptharray(1 To RowCount, 1 To ColCount)
For i = 1 To RowCount
For j = 1 To ColCount
If OptionButton7.Value = True Then
RealDeptharray(i, j) = RealDeptharray2(i, j)
End If
Next j
Next i
The idea is that if option button 6 is ticked then the "relative" or the "absolute" depth calculation is used to calculate the real defect depth and then a different "realdepth" value is used.
Any help is appreciated. If anyone needs any more information on my method or what I am trying to achieve then please do not hesitate to let me know.
Thank you very much for your help,
Best Regards,
Affan Khan
Bookmarks