+ Reply to Thread
Results 1 to 6 of 6

Run-time error 6 overflow

  1. #1
    Registered User
    Join Date
    02-26-2020
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 365
    Posts
    3

    Run-time error 6 overflow

    Hi all,
    I seek help to fix the below coding... I took over this spreadsheet from a former colleague. It was running smoothly for the past 3 months until now. Nothing has changed, in the files nor the code.
    The error Run-time error 6 overflow comes up on the highlighted part of the code below and I am not sure how to fix it. Someone please help? MUCH appreciated!!!


    Please Login or Register  to view this content.
    Last edited by Pepe Le Mokko; 02-26-2020 at 03:37 AM. Reason: Code tags - Title revision

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Help?! Run-time error 6 overflow

    Hi Nathan,

    Welcome to the forum!!

    Note you must wrap any code you post like this...

    [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE]

    ...though as it's your first post a moderator will do it for you this time.

    I think the issue is the way you're setting the x, y and z variables in that x and y are variants but as z is an integer it only has a maximum positive value of 32,767 whereas from 2007 an Excel sheet has 1,048,576 rows so the value you're trying to assign to z is probably more than 32,767 (click here for a great overview on variables).

    See if setting those three variables like this helps:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Run-time error 6 overflow

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules. Thanks

  4. #4
    Registered User
    Join Date
    02-26-2020
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 365
    Posts
    3

    Re: Help?! Run-time error 6 overflow

    Hey Robert,

    Thanks for taking the time and suggesting a fix up. It did NOT work though.

    I am attaching the file, if you wouldn't mind having a look over it please?!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-26-2020
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 365
    Posts
    3

    Re: Run-time error 6 overflow

    Thank you Pepe Le Mokko, and apologies for that!

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Run-time error 6 overflow

    Does the error actually occur for you with that sample workbook? (I get lots of other file path errors but never the error you mention)

    Anyway, try changing Value at the end of that line to Value2.
    Rory

+ 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. Run-time error '6' overflow
    By tranxcop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-18-2015, 09:00 PM
  2. Run-time error 6: overflow
    By onmyway in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-02-2015, 06:24 AM
  3. Run-time error '6': Overflow HELP!
    By Nils88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2013, 06:46 AM
  4. [SOLVED] Run-Time error 6 'Overflow'
    By guatelize in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-20-2012, 07:08 AM
  5. [SOLVED] Run-time error '6': Overflow
    By msawyer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-14-2012, 01:29 PM
  6. Run time error 6 Overflow?
    By ben5496 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-06-2011, 09:00 PM
  7. Replies: 1
    Last Post: 07-21-2006, 07:05 AM

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