+ Reply to Thread
Results 1 to 11 of 11

Macro which will filter and paste data to new worksheet

  1. #1
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Macro which will filter and paste data to new worksheet

    Hi,

    I need some help with a VBA code as I have no experience with writing a macro.

    I have an unsorted data sheet which I need to extract information from and with each data extract I need it to create and save a new workbook.
    1. On the tab GL – Column A I have a branch code consisting of 3 digits. What I need is a macro which creates a new workbook splitting out each branch.

    e.g. in the example supplied I would like 5 new worksheets created showing data for branch 181 on one work sheet, 182 on another, 183 on another etc etc

    2. For each new worksheet am I able to define the worksheet name – ideally I would like the branch name e.g. “181”

    3. Is there any way in which I can define the workbook name and location to save to (if it doesn’t exist I would like it created).

    I know this is a big ask – if there is a similar workbook that exists that I can copy the logic that you know of please point me in the right direction.

    Any help is appreciated.

    Paul
    Attached Files Attached Files

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Macro which will filter and paste data to new worksheet

    Hello Paul

    Give a try to this.
    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Macro which will filter and paste data to new worksheet

    Hi

    Thank you Fotis for replying so quickly.

    That is what I am trying to achieve but rather than create a new worksheet I would like it to create a new workbook - can the code be tweeked to do this?

    Ideally I would like the files to be saved directly to here:
    P:\Test\Finance\manacc\MAN_ACC\Test2\2014\Mth0214\Transactional Reports\Hygiene

    If that path doesnt already exist then I would like it created.

    Could the file names be automatically defined e.g. "Transactional Report and the branch number (from column A) and the Month (I can define this in the macro each month)

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Macro which will filter and paste data to new worksheet

    HaHoBe, in this thread provided a code for that! I don't like to copy that code and gives to you as mine!

  5. #5
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Macro which will filter and paste data to new worksheet

    Hi,

    Thanks for the link, I still need a bit of help please:

    Currently the macro saves the file to the same desitnation as the orignal file:

    Please Login or Register  to view this content.
    Is there any way I can change this to:

    P:\Test\Finance\manacc\MAN_ACC\Test2\2014\Mth0214\Transactional Reports\Hygiene

    And then rather than that file name e.g. "182140318_090259" could I have:

    "Transactional Report and the branch number (from column A or the tab name) and the Month (I can define this in the macro each month)

    I dont know how to amend the code to do this.

    Regards

    Paul

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Macro which will filter and paste data to new worksheet

    ...I dont know how to amend the code to do this.

    Me too Paul!! Sorry!

  7. #7
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Macro which will filter and paste data to new worksheet

    Hi,

    I have found a code here:

    https://sites.google.com/a/madrocket.../sheet1-to-wbs

    But I would like to try and add elements of this code to yours Fotis.

    Is there any way I can add these elements to your original code?:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    I have uploaded a file which contains the 3 macros - I would like to merge the 3 really (your orignal code with the file path and file name elements).

    Regards

    Paul
    Attached Files Attached Files
    Last edited by JBeaucaire; 12-27-2019 at 04:02 AM.

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Macro which will filter and paste data to new worksheet

    I just asked for help Paul. Lt's wait for a while.

  9. #9
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Macro which will filter and paste data to new worksheet

    Try:
    Please Login or Register  to view this content.
    Last edited by ragulduy; 03-18-2014 at 06:30 AM.

  10. #10
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Macro which will filter and paste data to new worksheet

    Perhaps:
    Please Login or Register  to view this content.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  11. #11
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,689

    Re: Macro which will filter and paste data to new worksheet

    Hi,

    Thanks for the codes supplied here.

    @ragulduy - I dont think this worked as it has not created new workbooks.

    @Izandol - I think this may just be what I am after!! I will test it and report back (currently out of the office)

+ 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. [SOLVED] Need help with a macro to filter data and paste it in the corresponding worksheet
    By odoualex in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-17-2013, 02:35 PM
  2. Macro to Copy/Paste Cells if Data is found with Filter
    By CMPidgeon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-16-2012, 04:05 PM
  3. [SOLVED] Macro to Filter Data and Paste in new Workbooks
    By willy91785 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-19-2010, 11:14 AM
  4. how to filter and copy data from one sheet and paste to new worksheet
    By mr_asrul in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-03-2008, 07:15 AM
  5. Replies: 5
    Last Post: 03-18-2006, 08:45 AM

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