+ Reply to Thread
Results 1 to 11 of 11

How to copy data from a sheet based on a cell value?

  1. #1
    Registered User
    Join Date
    08-10-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2007
    Posts
    34

    How to copy data from a sheet based on a cell value?

    Hi Guys,
    Excel 2007
    I am very much in need of assistance to complete some work I am doing

    I am trying to build a template to compile build lists
    I am stuck & would appreciate any ideas how to proceed

    Ref to attached worksheet as needed
    This is the process so far:

    1. From a Dropdown List select a Number (I have no problem setting this up)

    2. Based on 1st selection, a 2nd second selection is made from a new dropdown box (This ok too)

    3. Each possible selection has its own sheet & the sheet is called whatever the number is.

    I just can't get the following to work & would appreciate help

    4. (a) Clear all rows below row with the selected cell
    (b) Based the value returned by the selected cell, find the sheet with the same name (E.g selection = AD0250 sheet name must = AD0250)
    (c) Copy all data on the sheet named AD0250 & place it in Column A & 1 row directly below the selected cell

    5. Once the 'copy' has been done prevent any changes to cells B1 or B7

    Note: Data on the copied sheet can include addition Dropdown Lists or data based on a VLookup using different


    Thanks in advance

    Regards

    Bill
    P&T Raw Data1.xlsx
    Last edited by Bill Williams; 09-26-2011 at 08:50 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to copy data from a sheet based on a cell value?

    This is my non-VBA approach...
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-10-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: How to copy data from a sheet based on a cell value?

    Thank You very much Jerry,
    This looks like it will work for me but Row 8 to 11 inclusive are missing

    Assy1 Plane Body 4.7T
    Assy2 Plane Axle 4.009
    Assy3 Plane Engine 2.05
    Blank Line

    Assy 1 to 3 are 'Lists'
    Will it still work?

    Kindest Regards
    Bill

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to copy data from a sheet based on a cell value?

    How about this...

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-10-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: How to copy data from a sheet based on a cell value?

    Hi Jerry,
    So close but,
    Location has moved & prefer original structure to remain if possible
    Pretty sure I could fix anyway & can live with it if essential

    The real problem is that the 3 assys are not maintained as "Dropdown Lists"
    This is absolutely vital
    I appreciate the time & effort you are making

    Kind Regards

    Bill

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to copy data from a sheet based on a cell value?

    Ok, you can't have formulas and drop down lists in the same cell, so this final layout DOES give you your Assay drop downs in the same position, but you will have to use the drop downs to make selections.

    Also, using drop downs allows you to create scenarios where you had selected assays from train parts and then switched to plane and the old values still showed. I created a couple of named formulas called ErrorCheck and ErrorCheck2 that are then used in conditional formatting to cause the old values to be "hidden" if the current values no longer match the drop down values for that existing selections above.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-10-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: How to copy data from a sheet based on a cell value?

    Looking good Jerry,

    Sadly I have not worked out all of how you did it yet
    Had I done so I could fixed the couple of small problems that are left

    Problem 1
    The number of rows returned below description are incorrect
    IE less than the "Item Count"
    2 to 4 lines missing
    (There are zero if "Train 1960-1969" selected but that is not an error; needs data entered)

    Problem 2
    Assy 2 & 3; field hidden even if seemingly correct

    Sorry I just don't understand yet how these work so I have no idea how to correct them myself

    Thank you Kindly

    Bill

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to copy data from a sheet based on a cell value?

    I've added some flags in C8:C11 (names shown in D8:D11) that show how the conditional formatting formulas in B9:B11 are working.

    B7 uses the conditional formatting formula ErrorCheck2 which test the current DV list and sees if the currently displayed VALUE belongs to the current list. If so, TRUE, the value stays visible, else FALSE and the CF hides it until you change it.

    Same for B9:B11. Each now has it's own ErrorCheck formuas B, A or E. So, as the values appear and disappear, click on the TRUE/FALSE cell and use the Evaluate Formula tool to watch it unfold until you understand how these formulas are working. Since it's a named Formula, that's how it's being used in B7, B9:B11.

    Once you figure how that's working, you can delete those reference cells C8:D11.

    I've also changed the way the Item Count works, not it, too, works exclusively off of the part numbers you list on each sheet. No other data comes from those sheets, it's all coming from the VLOOKUP database.

    Beyond that, any specific questions?
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-10-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: How to copy data from a sheet based on a cell value?

    Sorry for delay in reply Jerry,

    I am still in the learning phase

    I am much indebited to you & will let you know the outcome

    Regards

    Bill

  10. #10
    Registered User
    Join Date
    08-10-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: How to copy data from a sheet based on a cell value?

    I have marked this as solved.
    I am very much appreciative of the help
    Not only does this work but also I learnt so much.


    If there is a prob then the only one is that it looks like I will have to be very careful when updating or modifing in future.

    I understand that this is a non-VBA approach, do you think a VBA approach could make it simplier or safer for future mods?
    Do you think I should still pursue a VBA approach?

    Thank You

    Bill

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to copy data from a sheet based on a cell value?

    You would have to take care with any extensively designed workbook, right?

    As long as you understand this, I would use a non-VBA approach. It's much safer to "share" workbooks without VBA, some people/companies do not allow macros at all, so they wouldn't be able to see it working at all.

    If you do go the VBA route, changes to your workbook would typically require the same kind of care, and possible extensive maintenance, so I don't see it being less work overall. You have to manage the process either way.

+ 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