Consulting

Results 1 to 3 of 3

Thread: Double Type error 13

  1. #1
    VBAX Regular
    Joined
    Sep 2016
    Posts
    24
    Location

    Double Type error 13

    Sorry guys,
    I'm not getting to the solution on this problem. This simple script should just apoint the value of a column to a variable(). But If I run the script, I get error 13 because of wrong type?? All the Variables like modulstafunc, modulendfunc are correct. Even the value of Activecell.Value is correctly shown, I simply cant explain it.

    Sub Macro7()
    Dim modulfunc() As Double
    Dim loopcounterfunc As Long
    Dim Modulstafunc As Long
    Dim Modulendfunc As Long
    C = Range("B7", Range("B7").End(xlDown)).Count
    Modulstafunc = 7
    Modulendfunc = C + 6
     ReDim modulfunc(Modulstafunc To Modulendfunc) 
     For loopcounterfunc = Modulstafunc To Modulendfunc
    Cells(loopcounterfunc, 2).Select
    modulfunc(loopcounterfunc) = ActiveCell.Value
    Next loopcounterfunc
     End Sub
    Thanks for your ideas!!! Jens
    Last edited by Aussiebear; 09-20-2016 at 04:14 PM. Reason: Added code tags....(again)

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    modulefunc() is for Doubles

    If something in B7:Bx is text or something that cannot be converted to a Double, you'll get a 13
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Dim modulfunc
    Dim loopcounterfunc As Long
    Dim Modulstafunc As Long
    Dim Modulendfunc As Long
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

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