+ Reply to Thread
Results 1 to 7 of 7

Macro Ending Early - When Using Range.Value on some macros?

  1. #1
    Registered User
    Join Date
    06-05-2013
    Location
    USA
    MS-Off Ver
    2003, 2010, 2013, 2016
    Posts
    12

    Macro Ending Early - When Using Range.Value on some macros?

    For some reason my code is exiting early, and I really have no idea why. I'm triggering the PasteRangeMacro sub via the PasteDay1 sub (among others) and it's really annoying that the macro isn't finishing, among other reasons because the code doesn't re-enable events and reset the calculation status.
    It gives the "test0" debug print, and triggers the StartCell.Resize(DayRows,7).Value line, but does not trigger any of the following lines. I use Range.Value in other macros without this problem, so I'm stuck. Any ideas? Thank you so much.

    I'm using the latest version of Excel with a file format of .xlsm on a Windows 10 computer.

    Please Login or Register  to view this content.
    Last edited by bkm2016; 05-28-2017 at 04:41 PM. Reason: marking solved

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Macro Ending Early - When Using Range.Value on some macros?

    The Range variable CopyStart is never assigned to a worksheet range. It is set to the value of a variable called StoredCopyCell but that is never initialised either...

    Also, the code, as posted, will not compile as StoredCopyRange is not declared and you cannot check an undeclared variable for 'Nothing'
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-05-2013
    Location
    USA
    MS-Off Ver
    2003, 2010, 2013, 2016
    Posts
    12

    Re: Macro Ending Early - When Using Range.Value on some macros?

    Sorry, they are declared as public variables in another macro.

    Give me a few minutes. I'll upload a modified version of my file.

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Macro Ending Early - When Using Range.Value on some macros?

    Not being pedantic - but you cannot declare a Public Variable in another macro... It must be in the General Declarations section of a standard code module. You set the value in a procedure, though.

  5. #5
    Registered User
    Join Date
    06-05-2013
    Location
    USA
    MS-Off Ver
    2003, 2010, 2013, 2016
    Posts
    12

    Re: Macro Ending Early - When Using Range.Value on some macros?

    You know what I meant, that's right. Thanks for helping other people, since I wasn't clear

  6. #6
    Registered User
    Join Date
    06-05-2013
    Location
    USA
    MS-Off Ver
    2003, 2010, 2013, 2016
    Posts
    12

    Re: Macro Ending Early - When Using Range.Value on some macros?

    The file is too large to upload but here are the two relevant modules:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by bkm2016; 05-28-2017 at 02:52 PM.

  7. #7
    Registered User
    Join Date
    06-05-2013
    Location
    USA
    MS-Off Ver
    2003, 2010, 2013, 2016
    Posts
    12

    Re: Macro Ending Early - When Using Range.Value on some macros?

    I'm not really sure what I did, but I'm not having the problem any longer. Maybe adding screen updating helped, but I'm not sure. Anyway, just in case someone else has a similar problem, my new code is below.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    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)

Similar Threads

  1. Ending Macro - Variable Range
    By Austex_egger in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-22-2013, 02:52 PM
  2. Need help identifying a value range for ending a Loop Until
    By erik1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2013, 05:19 AM
  3. [SOLVED] Macro stops too early - Help!
    By cossie2k in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-25-2012, 10:15 AM
  4. Inserting text based on a predetermined criteria early in the macro
    By MonkeyFlyer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2012, 06:06 PM
  5. determine begining row,col and ending row,col of variable range
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 07-17-2011, 08:09 PM
  6. Ending macro early
    By TedH in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-20-2009, 11:45 AM
  7. Ending Macros
    By lj123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-12-2008, 01:10 PM
  8. Ending a macro early conditionally on one cell being blank
    By Rokuro kubi in forum Excel General
    Replies: 3
    Last Post: 05-26-2006, 09:15 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