Results 1 to 14 of 14

Copy from 'Data' sheet to others

Threaded View

  1. #1
    Registered User
    Join Date
    10-31-2011
    Location
    Shropshire, UK.
    MS-Off Ver
    Excel 2003
    Posts
    14

    Copy from 'Data' sheet to others

    The attached file shows where i'm at. What it does is sort the 'Data' sheet onto named sheets according to the number within the data in column 4. I have working code but with over 7k lines in the 'Data' sheet the operation is a little slow. Can anyone suggest some changes to help? I have heard that cut n paste is the slow way of doing things!

    Any suggestions on how I can combine another function so that when the 'Move Stuff' routine is called, it checks for duplicate data in the target sheet and deletes it?

    Here is the main code:

    Sub MoveData()
    Application.ScreenUpdating = False
    Dim PointNo As String
    Dim LastRow As Long
    Dim Text As String
    LastRow = [A65536].End(xlUp).Row
    For I = 2 To LastRow Step 1
    Sheets("Data").Select 'Select the DATA tab
    Text = Cells(I, 4) 'Text = value of cell i:4
    PointNo = Mid(Text, 3, 4) 'start at 3 and next 4 chars
    Rows(I & ":" & I).Copy 'copy entire row
    Sheets(PointNo).Select
    Selection.EntireRow.Insert
    ActiveCell.Offset(1, 0).Select 'select next line on that sheet for next visit
    Next I
    Sheets("Data").Select
    MsgBox "Sort Complete", vbInformation
    Application.ScreenUpdating = True
    End Sub
    Also there are no error traps should something dodgy be encountered, ie Destination sheet doesn't exist.

    Thanks
    Attached Files Attached Files
    Last edited by j3di; 11-14-2011 at 07:46 PM.

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