+ Reply to Thread
Results 1 to 14 of 14

copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

  1. #1
    Registered User
    Join Date
    01-12-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    17

    copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    Hi,

    I have avoided doing macros before however now I think I need one.
    I have noticed that the basic problem I have is a common one on this forum with different varibles for different people.
    I have attached a dummy copy of the spreadsheet that I am using.

    I need to copy cell information for one spreadsheet to one of 2 other spreadsheets depending on a dropbox condition.
    The master spreadsheet is the Issues spreadsheet, and depending on whether the user chooses Transferred Complaints or Transferred Offences (in Column K) I need to transfer certain cells to the Complaints or Offences spreadsheets.

    The information I need to transfer from Issues is:
    Ref # - (Column A) -> (Column A)
    Reported Advisor - (Column C) -> (Column D)
    Organisation - (Column G) -> (Column E)
    Complainant Name - (Column H) -> (Column F)
    Closed Date - (Column L) -> (Column B)

    The copy would happen when the user chooses Transferred Complaints/Transferred Offences in Column K. There are other options in that drop box but the do not need to be transferred.

    I hope this all makes sense.
    Thanks in advance
    Attached Files Attached Files
    Last edited by Gauntsghost; 01-14-2010 at 05:11 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: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    When you say "transfered to the other sheet" do you mean MOVED or just COPIED?

    And I assume you don't want those "links" like you've put in the other sheets, rather just have the actual flat data in there?
    _________________
    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
    01-12-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    Sorry I mean copied.
    And no those links were just my 'basic' way of getting the data across.

  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: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    1) Right-click on the ISSUES tab and select VIEW CODE
    2) Paste in this sheet event macro
    Please Login or Register  to view this content.
    3) Close the editor and save your sheet.
    4) Make a choice in column K and it will COPY to the subordinate sheet

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

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    Note, there's nothing to stop you from putting the same row on the subordinate sheet over and over again. We can add that...so that if you attempt to move an item to OFFENCES more than once it notices the column A "REF #" already exists on the sheet and either:

    1) Aborts putting it there again completely
    2) Enters the values again in the same row, overwriting the old values

    This version does #2 above:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 01-13-2010 at 05:52 PM. Reason: Code tweaked

  6. #6
    Registered User
    Join Date
    01-12-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    Thank you very much JBeaucaire.
    That is perfect.


  7. #7
    Registered User
    Join Date
    01-12-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    Hi again,

    I've been told that I now have to put 3 more options into the drop box, (Trivial, Resolved, Insufficent Evidence) these don't need to be copied anywhere. However when 1 of these options are selected they cause a error.
    What do I need to insert to correct this?

    Thanks

  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: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    The macro has no effects for any values other than:

    "Transferred Offence"
    "Transferred Complaint"


    All other values are ignored in my testing. Post up your misbehaving workbook with the macro installed so I can take a look.

  9. #9
    Registered User
    Join Date
    01-12-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    Here is the workbook with the problem.
    I had to insert another column at K, however I changed the macro to show this.
    I am using Excel 2003

    Thanks
    Attached Files Attached Files

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

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    Ah, I see, I restructured the macro a little on my final pass through and needed to add a section to specifically cover all other values, something my original macro didn't need to do...here you go:
    Please Login or Register  to view this content.
    EDIT: I noticed you weren't using the later version of the macro I posted.
    Last edited by JBeaucaire; 01-14-2010 at 05:10 PM. Reason: code updated to OPs version.

  11. #11
    Registered User
    Join Date
    01-12-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    Perfect. Thank you again.

  12. #12
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    I have been looking for a way to do something similar to this, with a minor difference. In my request somewhere on this forum I was looking for a way to only transfer (copy) specific cells from one page to another (A4:C4,F4,I4:Q4) so that when it transfers it falls into (A4:M4) for formatting purposes. In this i wanted a way to aviod double transfering the same data as well as a way to only allow data to be transfered if (F4) had a "y" in it vs a "n".

    In doing this I am coding a button in so that one row/line at a time in a given section will be transfered at a time if needed based on the "y" vs "n"

  13. #13
    Registered User
    Join Date
    12-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    basically i have a workbook used to keep track of 16 (+/-) sales people per year. Each sales persons sheet is formatted the exact same way, broken down on a month to month basis.
    January on each page is in Cells A4:Q34, February is in Cells A36:Q66...etc etc
    what I am looking to do is transfer the data one row at a time within these blocks to another formatted sheet that will display all the sales peoples transfered data for January, again broken down but this time by sales person.

    example:
    [John Smith]
    January Cells A4:Q34
    February Cells A36:66

    [Jane Smythe]
    January Cells A4:Q34
    February Cells A36:M66

    Transfered to Sheet January
    [January]
    John Smith Cells A4:M34
    Jane Smyth Cells A36:M66

    now within John Smith's Janaury Block IF, F4 on any of the rows is yes, I want to be able to click a button and transfer that data from the row (one row at a time) the January sheet, and into the Block for John Smith.

    i dont know if that is possible, I have been asking for help on this for a bit and have yet to find a solution.

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

    Re: copy certain cells from 1 spreadsheet to other spreadsheet depending on condition

    Jabryantiii, be sure to read through the Forum Rules so you can use and follow them effectively. For instance, you are not allowed to start questions of your own in someone else's thread...just offer assistance to them.

    Start a thread of your own, feel free to include a link in your post to this thread if you find it relevant.

    When creating your post, click on GO ADVANCED and use the paperclip icon to attach a sample workbook displaying your data and desired results.

    Talk to you in your new thread.
    Last edited by JBeaucaire; 01-14-2010 at 07:09 PM.

+ 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