+ Reply to Thread
Results 1 to 4 of 4

Want to do a while-loop but get error message: run error '6' overflow

  1. #1
    Registered User
    Join Date
    12-04-2011
    Location
    stockholm
    MS-Off Ver
    Excel 2010
    Posts
    2

    Want to do a while-loop but get error message: run error '6' overflow

    Hi.

    This is the first code I wright in VBA and I don't have much experience in programming. I want to do a while-loop and I want the program to get data from cells in the excelsheet. I want it to get the data from cell with column E and row 1-7.

    C D E
    1 h = 870
    2 L = 740
    3 ac = 30
    4 z = 840
    5 täta = 48,6148
    6 c1 = 880952,4
    7 sigma = 58,73016


    Please Login or Register  to view this content.
    When I trie to run it I get the error message:

    run error '6'

    overflow


    Can anyone please help me?

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Want to do a while-loop but get error message: run error '6' overflow

    Try declaring your variables as Long. There is a limit to the maximum size of an integer.
    Martin

  3. #3
    Registered User
    Join Date
    12-04-2011
    Location
    stockholm
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Want to do a while-loop but get error message: run error '6' overflow

    Okej thank you for the answer mrice.

    I got another error message when I changed and declared my variables as long.

    I declared variables like below, otherwise the code is the same.

    Sub sigma()
    Dim h As Long
    Dim L As Long
    Dim a As Long
    Dim hp As Long
    Dim t As Long
    Dim ac As Long
    Dim z As Long
    Dim täta As Long
    Dim c1 As Long
    Dim sigma As Long
    Now I got the error message:

    runtime error 438

    object doesn't support this object or method

    Any ideas what's wrong?

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Want to do a while-loop but get error message: run error '6' overflow

    Try

    Please Login or Register  to view this content.

+ 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