+ Reply to Thread
Results 1 to 10 of 10

Macro to Copy a whole row to the next available line on another sheet based on a value

  1. #1
    Registered User
    Join Date
    01-27-2020
    Location
    United States
    MS-Off Ver
    16
    Posts
    9

    Macro to Copy a whole row to the next available line on another sheet based on a value

    Hey Guys, is there a a simple If/then statement that can do the following? Or do I need to venture into Macros?

    Basically if column A contains "text X" copy the whole row to the next available line on sheet 2. And if column A contains "text Y" copy the whole row to the next available line on sheet 3. If it helps I only have 3 text strings that I need to use (So "X", "Y", "Z").

    if(A1="x", Copy to sheet2,....something something?

    Thanks for any help!

    Edit:It occured to me there may be a better way to get to my end goal, so I should post that too. I have rows of data that gets classified in 1 of 3 (X, Y,Z) ways. I want to be able to manipulate and graph all the data that only falls under X or Y or Z.
    Last edited by AaronBurr; 02-28-2020 at 05:04 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: IF/Then Statements

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    I suggest that you call your thread Macro to Copy a whole row to the next available line on another sheet based on the value of a cell.

    Once that is done i will be back to help you.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    01-27-2020
    Location
    United States
    MS-Off Ver
    16
    Posts
    9

    Re: Macro to Copy a whole row to the next available line on another sheet based on a value

    Thank you Mehmetcik, I updated the title based on your suggestion. I appreciate the help If this can't be done with formulas would I be better off posting in the macro section? I wasn't sure at time of posting if a macro would be required and its probably beyond my skill set.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to Copy a whole row to the next available line on another sheet based on a value

    Please move to the Macro section if you can.

    Meanwhile I will work on this for you.

    However I need one bit of information first.

    Do you want the rows moved as you enter the data.

    Or do you want this done all at once.

    Or both?

  5. #5
    Registered User
    Join Date
    01-27-2020
    Location
    United States
    MS-Off Ver
    16
    Posts
    9

    Re: Macro to Copy a whole row to the next available line on another sheet based on a value

    I won't be editing the data live, just adding to it. I think by the end I'll have maybe 500 rows of data? As long as it doesn't slow it down, I would say which ever is simpler so I have a better chance at understanding it?

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to Copy a whole row to the next available line on another sheet based on a value

    Ok I have one last question. How Many Columns of data do you have?

  7. #7
    Registered User
    Join Date
    01-27-2020
    Location
    United States
    MS-Off Ver
    16
    Posts
    9

    Re: Macro to Copy a whole row to the next available line on another sheet based on a value

    There are seven columns. Thanks again

  8. #8
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to Copy a whole row to the next available line on another sheet based on a value

    I have kept this simple.

    Have a play while I annotate it so you can understand what I am doing.

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 02-28-2020 at 07:44 PM.

  9. #9
    Registered User
    Join Date
    01-27-2020
    Location
    United States
    MS-Off Ver
    16
    Posts
    9

    Re: Macro to Copy a whole row to the next available line on another sheet based on a value

    WOW! You got this together really really fast, That's amazing!! Thank you so much!! It'll take me a bit to work through all the coding (I'm working on my VB skill but its still pretty rudimentary). Initially running it the X function works perfectly. However the Y and Z seem to be a bit funky. It seems to adds blank rows between data sets? But this could be me doing something incorrectly. I will play with it later tonight but I wanted to thank you for working with me on it! I'm very grateful.

  10. #10
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to Copy a whole row to the next available line on another sheet based on a value

    Thanks for the feedback. I have corrected the Macro in Post #8.

+ 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. Formula with nested IF statements & AND statements
    By Hollywood44 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-11-2018, 03:38 PM
  2. Formula with multiple IF statements and IF AND statements
    By lottidotti in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-14-2013, 08:03 AM
  3. Reading If statements and formulating values from if statements
    By crnam in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-16-2013, 05:20 AM
  4. Multiple nested IF statements and AND statements
    By TonyGetz in forum Excel General
    Replies: 2
    Last Post: 12-14-2010, 03:07 AM
  5. Nested If statements / logic statements
    By Brainless_09 in forum Excel General
    Replies: 3
    Last Post: 06-17-2009, 02:59 PM
  6. Replies: 12
    Last Post: 05-15-2009, 08:38 AM
  7. [SOLVED] operator statements, shorting when reusing one of the statements?
    By KR in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2005, 02:05 PM

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