+ Reply to Thread
Results 1 to 3 of 3

optimize the Code needs to run faster

  1. #1
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Pakistan
    MS-Off Ver
    Excel 2013
    Posts
    256

    Angry optimize the Code needs to run faster

    HI All,

    Iam using the below for pasting the sheet 2 data to sheet 1 starting range B7. I have write i think so 200 lines like the below code getting data from different sheets to sheet 1 ranges. How can i optimize this code this macro go for each range to 5000 then paste to B7 range sheet 1 it takes lot of time to execute?


    arr = Sheets(2).Range("B2:B5000" & Sheets(2).UsedRange.Rows.Count).Value
    Sheets(1).Range("B7").Resize(UBound(arr)) = arr

    Thanks
    Farrukh
    Last edited by farrukh; 01-24-2012 at 10:35 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: optimize the Code needs to run faster

    Hi farrukh,

    Here is my favorite site about optimization topic.
    http://www.cpearson.com/excel/optimize.htm

    I hope this helps.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: optimize the Code needs to run faster

    Probably you better copy sheet 2 and delete in the copy what isn't necessary.



+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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