+ Reply to Thread
Results 1 to 10 of 10

Excel crashes when pasting function to range

  1. #1
    Registered User
    Join Date
    04-22-2022
    Location
    Europe
    MS-Off Ver
    2016
    Posts
    2

    Excel crashes when pasting function to range

    Hi Geeks,
    I'm new at VBA so need Your help.

    Have a code with copy function from a cell and pasting it to (more than 10.000) rows with this format:

    Range("f2").Copy Range("f3:f" & lrsmseg)
    Range("i2").Copy Range("i3:i" & lrsmseg)
    Range("j2").Copy Range("j3:j" & lrsmseg)
    Range("k2").Copy Range("k3:k" & lrsmseg)
    Range("l2").Copy Range("l3:l" & lrsmseg)
    Range("m2").Copy Range("m3:m" & lrsmseg)
    Range("n2").Copy Range("n3:n" & lrsmseg)
    Range("o2").Copy Range("o3:o" & lrsmseg)
    Range("r2").Copy Range("r3:r" & lrsmseg)

    where lrsmseg is the number of the last row on sheet. (most commonly between 40k and 50k)

    Using this method excel crashes.
    But file is well made and saved to the directory...
    Shall I 'wait' between the lines???

    If I use for next cycle it is ok but very very very slow!


    Any idea is appreciated!

    Thanks in advance,
    Peter

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,246

    Re: Excel crashes when pasting function to range

    Try:
    Please Login or Register  to view this content.
    Artik

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,545

    Re: Excel crashes when pasting function to range

    Another possibility.
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,545

    Re: Excel crashes when pasting function to range

    Don't know which of the suggestions is fastest but would be nice to find out.
    This might be slightly slower.
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,545

    Re: Excel crashes when pasting function to range

    You're not going to run short of trying different ways without crashing Excel.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-22-2022
    Location
    Europe
    MS-Off Ver
    2016
    Posts
    2

    Re: Excel crashes when pasting function to range

    Dear Artik,
    Dear Jolivanes,

    Thanks for your replies and for wasting time with my problem! This is very kind!
    Unfortunatelly these methods gave the same result. The report is ready, not faster, and at the end excel crashes.

    I thought the problem is somewhere else, probably with the computer...

    Anyway, thank You for all!

    Regards,
    Peter

  7. #7
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,246

    Re: Excel crashes when pasting function to range

    In that case, try to clean up your project using the VBADecompiler tool.

    Artik

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,696

    Re: Excel crashes when pasting function to range

    What is/are the function/s you are copying? What does the rest of the code look like?


    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.

    Note: representative sample, NOT 40k-50k rows.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,545

    Re: Excel crashes when pasting function to range

    Just to make sure, I timed the results.
    The times for the three macros in Posts 3, 4 and five for 50,000 cells are 0.25 sec, 1.9 sec and 0.16 sec and no crashes so the problem must be from somewhere else.

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,545

    Re: Excel crashes when pasting function to range

    Just to help other people that might encounter the same or similar problem.
    How did you, if you indeed did, solve the problem of crashing?

+ 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. Excel Crashes when I Run the function
    By Must06 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2019, 04:07 AM
  2. Replies: 4
    Last Post: 09-01-2017, 04:09 PM
  3. Replies: 2
    Last Post: 02-27-2016, 12:18 PM
  4. Replies: 0
    Last Post: 08-28-2013, 06:45 AM
  5. For loop crashes Excel when filling a cell range with string value
    By icyrius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-04-2013, 09:41 AM
  6. select function crashes the excel
    By assaf1978 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2011, 06:01 AM
  7. [SOLVED] Help with function that crashes Excel
    By Ken Loomis in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-13-2005, 09:05 PM

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