+ Reply to Thread
Results 1 to 13 of 13

Required VBA for filter data & transfer data

  1. #1
    Forum Contributor
    Join Date
    01-29-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    434

    Required VBA for filter data & transfer data

    Hello Team

    We want a VBA for solving my work..

    We have a workbook with 12824 road record each data in single row (we submit sample datasheet of 20 record)

    We want a vba for my entry sheet... where ENTER DISTRICT NAME IN CELL B2 THEN DIVISION NAME IN D2 THEN DISPLAY THOSE MATCHED RECORD FROM DATASHEET TO THIS SHEET &

    WHEN WE PRESS Y in Cell I2 THEN TRANSFER THIS sheet DATA from row 6 TO end of filtered data in to PROGRESS SHEET (both sheet password is abc)

    (this is my sample sheet we have 12824 road data with 75 distric & each distrcit has 3-4 divsion)

    I know this is possible with Filter but in Filter we filter then copy then each time so we want a VBA

    if we press only Enter & District Name or division Name then display all District data or if we chosse district name & press enter in Divisin name then display all divsion data in district (i.e. PD, CD-1 ,CD etc)


    Thanks in advance

    What result we want in entry sheet we also define...
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Required VBA for filter data & transfer data

    Hi,

    When you copy the data to the Entry sheet and Progress sheet will you clear the existing data and then repopulate them?
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  3. #3
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Required VBA for filter data & transfer data

    Hi,

    Here's a bit of code that you need to paste to the worksheet code module.
    It does not clear nor does it copy the data to the next empty row in the destination sheets.
    It can be modified for this.

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    01-29-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    434

    Re: Required VBA for filter data & transfer data

    Hello Charles
    Thanks For Ur Quick Responce On My Problem..

    We Copy This Code To Entry Sheet

    But This Not Work As Per My Requirement We Once Again Clear What I Want

    In Datasheet We Don't Want Any Change... After Run Vba ...

    In Entry Sheet

    Here We Required 3 Condition Filter

    (1) In Cell Value B2 When We Enter District Name (Any Name From Datasheet Colum B) Then Selected District Name Data Filter From DATASHEET & Copy Those Record Here.

    After That We want 2 more Condition

    1 .... To Filter One More Match Condition .. Which Is Division ... Cell Value D2 (its depend into district name only those division data filter which district name we enter in cell B2)

    2..... IN LAST ... If We Press Y (Yes) in cell value I2 then Copy this filter data (in entry sheet from Row No 6 to end) in PROGRESS SHEET.. LAST BLANK ROW

    (NO RECORD REMOVE FROM DATASHEET)


    in sort … when we enter distric name then vba start to wok

    I think we must use case statement with three target cell value (B2, D2 and I2 cell)

    Hope this time we clear what I want in my VBA…

    Looking for your +ve respose

  5. #5
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Required VBA for filter data & transfer data

    Hi,

    Been busy most of today.
    Will take another look.
    Hopefully another may pick up on this.

  6. #6
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Required VBA for filter data & transfer data

    Ok,

    If I understand you.

    1. When you select District you want the code to filter by the District Name and populate the data to the "Enter" Sheet.
    2. You will then decide which "Division" that you want. You select it and the code filters it.
    3. The result of which will be populated to the "Entry" sheet.
    4. If all is good you want to click on I2 and have the data in the "Entry" sheet copied to the next empty row in the "Progress" sheet.

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,529

    Re: Required VBA for filter data & transfer data

    Try it on a copy of your original.
    This code goes in a regular module.
    Click on the "Maybe" button in sheet ENTRY to run this code.
    It copies too many cells from the DATASHEET so you'll need to adjust to the right columns or let us know which cells you want copied.
    Please Login or Register  to view this content.
    This code goes in the ENTRY sheet module.
    Double click on cell I2 to run the code.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    01-29-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    434

    Re: Required VBA for filter data & transfer data

    Hi Charles
    U very well understand what i want...exactly same what i want.......

    Hello jolivanes ... ur provieded code work different from my requirement..
    when we press may be button then data display (as per cell b2 & d2).. but we want when we press enter after name entry then automatic data display

    & previous district filter data remove in entry sheet..(we check if all data is ok then we press y to cell I2 then this fillter data trasfer to progress sheet)

    hope u understand...

    Thanks both of u for sowing intrest...
    we add rep both of u for this help

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,529

    Re: Required VBA for filter data & transfer data

    In the code "Maybe" delete the "r.AutoFilter field:=3, Criteria1:=Sheets("ENTRY").Range("D2").Value" line
    Change the ENTRY Sheet code to this:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Required VBA for filter data & transfer data

    Hi,

    Not sure if you resolved this. And sorry it took so long to get back.
    But in this file when you open it a "Userform" will pop up.
    You can select the "District" form the list provided.
    This action will allow you to select the "Division". This list will only show the "Division"
    that it associated with the "District". You will notice that cells "B2" and "D2" will show your selections.
    If the data is ok you can the click the "Ok" button. This will copy the data in the "Enter" sheet to be
    copied to the next row in the "Progress" sheet.
    Each time you make a selection for the "District" the code will update the "Division" for selection.
    If you click on the "X". This will cause the form to unload. If you need the form again you can click on the
    button "Input Form" this will produce the form for selections.
    I hope this works for you.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    01-29-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    434

    Re: Required VBA for filter data & transfer data

    Hello Charles ur provided code work as per my requirement... only following error

    when we choose district then we want clear data in entry sheet before showing filter data.... currently if we filter agra district then 5 row data display ... & when we choose cd-2 division then only one road data dispaly we want....... but currently all district data display..

    ok button instad of input form.. we want saparat in entry sheet.. so that when we update data in entry sheet as per reuirement then we ensure that data is correct then press ok.. currently we bound with enter selection...we must enter ok with slection form..

    hope u understand what 2 change i want in this...

    again Thanks for showing.. intrest.. u take ur time as u much

  12. #12
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845

    Re: Required VBA for filter data & transfer data

    Hi,

    I erred on part of my code. This copy will now do as you want except
    I'm still using the userform.
    When you make your selection the "Enter" should now display the selections correctly.
    The "Ok" in the worksheet is only a reminder to click the "Ok" button in the userform.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    01-29-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    434

    Re: Required VBA for filter data & transfer data

    Thank you very much charles sir.. you solve my problem..thank ..

+ 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. Automatic filter and transfer data on other workbook
    By vintan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-16-2013, 03:59 AM
  2. Excel -> Visio data transfer - macro required?
    By interim in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-16-2013, 02:26 PM
  3. Transfer Required Data to a Different Worksheet Dependant on Cell Value
    By DGTech in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2012, 07:52 AM
  4. VBA for How filter out the required data and save the files
    By Anil2007 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-08-2009, 11:25 PM
  5. Show only required data and transfer to MS Word
    By Neil_Pattison in forum Excel General
    Replies: 2
    Last Post: 11-25-2005, 10:50 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