Using bottomXX macro failed

  • Hi helpers

    I run the macro below in the attached xls for sheet1 but always fail. I know that the code line below [bottomB = Sheets("sheet1").Range("B" & Rows.Count).End(xlUp).Row] that has a problem when debug but I dont know how to fix it to give the same results of the same entire macro I wan. If I run the same macro with over 3000 row data (in sheet2) it works so I assume that this fail in many data row.

    Can anyone help in this???

    Thanks in advance

  • Re: Using bottomXX macro failed

    Hi Zeanah,

    You need to change your variables to long as an integer range is -32,768 to 32,767 whereas the last row in an Excel 2007 or later sheet is 1,048,576 (the last row in Col. B of your worksheet is actually 72,843 more than double the max allowable for an integer variable).

    See here for a great review on variables by the founder of this site, the late Dave Hawley.



Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!