+ Reply to Thread
Results 1 to 5 of 5

Overflow error on Macro

  1. #1
    Registered User
    Join Date
    02-19-2015
    Location
    ottawa, canada
    MS-Off Ver
    2010
    Posts
    22

    Overflow error on Macro

    Hi Forum,

    I have this macro (which I will put at the bottom of this post) which runs perfectly fine at creating a directory list...until I ask it to do a directory with lots of records. It gets to record 32767, and overflows. Error occurs while executing the DoFolder Sub.

    Anything I can do or modify to let it complete the task at hand? The folder has over 100k of files to list.

    Thanks!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Overflow error on Macro

    Try setting r as long
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Overflow error on Macro

    It's almost certainly because you have r assigned as an integer. The largest value an integer can be is 32,767. Sound familiar?

    Try replacing the line where you declare r with:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-19-2015
    Location
    ottawa, canada
    MS-Off Ver
    2010
    Posts
    22

    Re: Overflow error on Macro

    Quote Originally Posted by walruseggman View Post
    It's almost certainly because you have r assigned as an integer. The largest value an integer can be is 32,767. Sound familiar?

    Try replacing the line where you declare r with:

    Please Login or Register  to view this content.
    Are you a mind reader or something? That's exactly the number it overflowed on!

  5. #5
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Overflow error on Macro

    Well, you did mention it in your first post.

    Anyway, if that solved your overflow problem, please mark this thread as SOLVED.

    And I'm sure anyone who provided good answers would appreciate some reputation (the * in the lower left of the posts)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro throwing Overflow error when calculating
    By jonboy6257 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-01-2013, 05:26 PM
  2. [SOLVED] Help with Macro! Overflow Error
    By Abdiel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2013, 09:02 PM
  3. Issue in macro getting overflow error
    By expert40 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2013, 11:43 AM
  4. runtime error 6 overflow when running a macro
    By Kim in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2006, 12:45 PM
  5. [SOLVED] overflow error 6.. the macro just stops any idea why?
    By ste mac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2005, 12:06 PM

Tags for this Thread

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