+ Reply to Thread
Results 1 to 16 of 16

Run Type error 13 Type Mismatch

  1. #1
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Run Type error 13 Type Mismatch

    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

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run Type error 13 Type Mismatch

    Affan

    Which particular line(s) is causing the error?

    What type of Option button is it, Forms or ActiveX?

    Does it have a linked cell?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    I think its Activex but I am not sure. I tried using the code tags I dont know why they havent worked...

    Please Login or Register  to view this content.
    '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
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    Mathematically I have traced the "root-cause" of the problem back to the if function that is below.



    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    Forum Moderator:
    I applologise if the tags are not working i am trying to post the code with the tags

  7. #7
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run Type error 13 Type Mismatch

    Affan

    I thinK I'm being thick but it's still not clear which line of code is the problem.

    You say it's the If, but there are 2 Ifs.

    Could you attach a sample workbook?

    Hopefully that will clarify things.

  10. #10
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    is there any way to attach the excel file?

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run Type error 13 Type Mismatch

    Click Go Advanced then scroll down and click Manage attachements.

    There should now be a window you can use to select and upload files.

  12. #12
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    can you seee the file?

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run Type error 13 Type Mismatch

    No, I'm afraid not.

    Here's a more detailed guide to attaching a file.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.

  14. #14
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    The file is failing to sent for some reason. I might be too big (4MB?)

  15. #15
    Registered User
    Join Date
    11-12-2012
    Location
    Aberdeen
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Run Type error 13 Type Mismatch

    Can I email you the file and then maybe you can share it with the members of the forum as there might be a problem with the file transfer mechanism.

    Thank you very much for your help in advance

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Run Type error 13 Type Mismatch

    Can you not create a cut down version and attach that?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1