+ Reply to Thread
Results 1 to 2 of 2

Help! Vba Copy Cell To Different Worksheet.

  1. #1
    Registered User
    Join Date
    11-03-2006
    Location
    Birmingham, UK
    Posts
    18

    Exclamation Help! Vba Copy Cell To Different Worksheet.

    Hi Everyone,

    I am trying to copy one worksheets contents to another worksheet cell by cell & a row at a time. This is because not all the fields need to be copied across & the data within some columns needs to be reformatted to fit correctly in the new worksheet.

    I have created VBA which does this but it takes forever to run as it switches through 3 worksheets & copies each cell one at a time.

    Is there anyway to improve the speed? the code is shown below.

    Any help would be grreatly appreciated & thanks in advance.

    Shuja

    What the following code does is take the active data cell within the 'DATA' worksheet (selected using the For..Next loop) and find the Field name title at the top of the column. It then looks at a worksheet (FIELDNAMES which has a list of field names from worksheet 'data' and the equivalent fieldnames for the 'TEMPLATE' Worksheet (where i want data copied to). The code then takes the field name equivalent for the 'Template' worksheet & selects the column name in the worksheet. with the row value attained from the 'DATA' worksheet, the code then copies the contents od the 'DATA' worksheet activecell into the 'TEMPLATES' worksheet activecell.
    This seems to work but i want to improve it's speed & performance.

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394
    Most of the time is when the screen refreshes. The first thing to do is turn this off. You could see a 20x improvement.

    Put this near the top of your code

    application.screenupdating=false

    and this near the bottom

    application.screenupdating=true

+ 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