+ Reply to Thread
Results 1 to 6 of 6

Copy 3 different cells over to a new wroksheet if specific data is entered in another cell

  1. #1
    Registered User
    Join Date
    06-26-2012
    Location
    new mexico
    MS-Off Ver
    Excel 2003
    Posts
    3

    Copy 3 different cells over to a new wroksheet if specific data is entered in another cell

    I HAVE THIS COD THAT COPIES OVER THE DATA FROM THREE CELLS IF ANY DATA IS ENTERED IN COLUMN T
    BUT I WANT TO COPY IT OVER TO A SPECIFIC WORKSHEET ONLY IF THE DATA IS SPECIFIC

    FOR EXAMPLE IF I ENTER "JM" IN COLUMN T I WANT THE DATA FROM COLUMN A,B AND G TO COPY OVER TO WORKSHEET "JM"
    IF I ENTER YH IN COLUMN T I WANT TO THE DATA FROM COLUMN A,B AND G TO COPY OVER TO WORKSHEET "YH"

    Sub Macro1()
    '
    ' Macro1 Macro
    '

    '
    Range("A5,B5,G5").Select
    Range("G5").Activate
    Selection.Copy
    ActiveWindow.ScrollWorkbookTabs Position:=xlLast
    Sheets("1").Select
    Range("A2").Select
    ActiveSheet.Paste
    End Sub


    PLEASE HELP

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Copy 3 different cells over to a new wroksheet if specific data is entered in another

    Since this is your first post, I'll remind you to enclose your code in code brackets so it's more legible. To do this, type a [ then type the word code, then type a ] then paste your code. At the end of your code, type [/ then type the word code, then type a ]. What you're asking to do in code is fairly simple, so please consider uploading your workbook with comments about where you'd like your data to be copied. Your code can be cleaned up a bit and made to run faster by not selecting data, and by not copying it but by setting one range equal to another. Much safer and more efficient. If you'll upload your book, I'll tweak your code so you see what I'm talking about.
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  3. #3
    Registered User
    Join Date
    06-26-2012
    Location
    new mexico
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Copy 3 different cells over to a new wroksheet if specific data is entered in another

    I just built the basic work book recently and just started with the coding. I am a beginner and just started with vba and coding so i really don't know a whole lot yet. It is just something i find interesting and want to learn.

    What i want it to do it doesn't seem like something simple.
    I have work sheets for each month and worksheets labeled from 1-40. What i want is if i enter a 1 in column "t" the data from column a b & g will copy and paste into worksheet "1" if enter a 2 in column "t" i want the data in those three columns to copy and paste to worksheet 2 and so on for all 40 sheets. If you could just get me started with the proper code for 1 row in the month worksheets or 1 month worksheet i think i can apply it to all 12 worksheets for the individual months. If not that is fine i just thought i could save myself some time by running through coding.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Copy 3 different cells over to a new wroksheet if specific data is entered in another

    This actually looks like it will be straightforward, but I need some clarification.
    Which sheet will you be making the entries on for the T column , which I assume you are using for a trigger/filter mechanism?
    Are you looking to copy the data, or move it?

  5. #5
    Registered User
    Join Date
    06-26-2012
    Location
    new mexico
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Copy 3 different cells over to a new wroksheet if specific data is entered in another

    I want the data to copy
    i will be entering data in the t column in worsheets title with the months of the year (june through july).
    And yes it is kind of a trigger/filter mechanism. I just want the data from the columns a b & g to copy over the worksheet with the corresponding number i enter into the t column.
    Thanks again!

  6. #6
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Copy 3 different cells over to a new wroksheet if specific data is entered in another

    See attached.

    Notes:
    This macro will move the data even if it's already been copied, so you will have to be careful when you run it not to do it again.

    There are two buttons, and I'm assuming you will be entering data one row at a time, then moving it. In that case, choose Move Latest. Move All will move every record on the current sheet.

    There is no safety feature built in to check and see if you've already moved a given row. If that's needed, and I'm betting it is, let me know and I can code for it.
    Attached Files Attached Files

+ 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