+ Reply to Thread
Results 1 to 3 of 3

How to move specific data from one worksheet to another worksheet

  1. #1
    Registered User
    Join Date
    06-11-2007
    Posts
    16

    How to move specific data from one worksheet to another worksheet

    Hi,

    I am totally NEW to macro (VBA or Excel).

    I wanted to know how to move specific data from a worksheet to another worksheet.

    For example, Worksheet1 contain below data:
    Order# Item
    ------------------
    10001 Pencil
    20004 Catridge
    10006 Ball Pen
    10003 Pencil Lead
    20006 Paper
    10005 Rubber

    The Order# is the raw data from users. I want to move the data that have Order# begins with 1 to a new worksheet (Worksheet2) and then Order# begins with 2 to another worksheet (Worksheet3).

    Can someone help?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I think you are making work for yourself with your planned use of Excel. Explain why you think you need all these separate pages, I'm sure that you don't if you plan the project properly and consider using Excel's fatabase features.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-11-2007
    Posts
    16
    Hi RoyUK,

    The reason for that is because when user sends me a list of raw data (e.g. Order# with other details), i would need to have it automate so that the specific data able to move to another worksheet, then make it a work tool for them to use. My user will keep on adding raw data to it and want to use it for a monthly analysis work.

    Initially, i just copy the whole data and sort the Order # in sequence and then remove those not related. Making a few command to that worksheet such as If funtion n so on...

    I found the below VBA script which short of the Begins with and if i want to add on few more columns for it to move from, how would i want to do?

    Sub MoveData()
    Application.ScreenUpdating = False
    For Each cell In Sheets("Master Listing").Range("a2", Range("a2").End(xlDown))
    Set mySheetName = cell.Offset(0, 1)
    On Error GoTo ErrHandler1
    Sheets("" & mySheetName & "").Activate
    On Error GoTo 0
    On Error GoTo ErrHandler2
    Sheets("" & mySheetName & "").Range("a1").End(xlDown).Offset(1, 0).Value = cell.Value
    On Error GoTo 0
    Next cell
    Sheets("Master Listing").Activate
    Application.ScreenUpdating = True
    Exit Sub

    ErrHandler1:
    Sheets.Add
    ActiveSheet.Name = mySheetName
    Resume

    ErrHandler2:
    Range("a1").Value = "Names"
    Range("a2").Value = cell.Value
    Resume Next

    End Sub

+ 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