+ Reply to Thread
Results 1 to 5 of 5

macro to copy data based on criteria

  1. #1
    Forum Contributor
    Join Date
    02-11-2008
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    242

    macro to copy data based on criteria

    Hi,
    I have this excel sheet,where I have an "Input" page where I have two criterias
    Project Desc& Item Description which I will input
    Now at the click of "SHOW DATA" Button,it will filter data based on those criterias in the "raw data" sheet,and copy them to another sheet
    Attached Files Attached Files
    Last edited by arnab0711; 02-20-2011 at 12:50 PM.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: macro to copy data based on criteria

    one of the options to do that, save attachment and make sure the following reference is on:

    1. [Alt+F11] - open Visual Basic window
    2. Tools - References - find and tick "Microsoft Activex Data Objects 2.0 Library"
    3. enter data and press the button

    Please note that sheets names are hardcoded in macro. In case you change sheet names you'll need to change sheet names in the code as well.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    02-11-2008
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    242

    Re: macro to copy data based on criteria

    Hi,
    First of all thanks so much for the solution,but I wanted to add another criteria in the "Input" sheet,pl advice what will be the code.

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: macro to copy data based on criteria

    hi, arnab0711, basically adding another criteria is rather simple. The syntaxis is the following:
    Please Login or Register  to view this content.
    T1.F18 - column of the data table we want take data from, here it is "Indent Unit Price". If it's text we are looking for UCASE is used to both "K" and "k" results. If there are several columns to search for we use AND:
    Please Login or Register  to view this content.
    '%K%' - what we are looking for in that column (appearence of K).
    I've added another search parameter for you. As you did not specify for which column should it be, I've done that by myself as an example.

    Hope this helps.
    Attached Files Attached Files
    Last edited by watersev; 02-20-2011 at 11:24 AM.

  5. #5
    Forum Contributor
    Join Date
    02-11-2008
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    242

    Re: macro to copy data based on criteria

    Hi,
    The third criteria will also be the Item descriptioncolumn,basically it would work as the contain filter option where use (contains .... and contains ....)

+ 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