+ Reply to Thread
Results 1 to 12 of 12

statements to copy and paste from one sheet to another

  1. #1
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417

    Thumbs up statements to copy and paste from one sheet to another

    Posted this about a year ago.

    http://www.excelforum.com/excel-prog...-workbook.html

    This is an add to request! I can't figure it out how to do this.


    Sheet2, Sheet4, Sheet6, Sheet8, Sheet10, Sheet12, Sheet14, Sheet16, Sheet18, Sheet20, Sheet22, Sheet24, Sheet26, Sheet28, Sheet30, Sheet32, Sheet34, Sheet36, Sheet38

    If G8 = “E” and if F8 = “H” and E8 is >=10 Copy A8:G8 and paste to sheet tab Sheet40.

    If G8 = “E” and if F8 = “E” and E8 is >=1 Copy A8:G8 and paste to sheet tab Sheet40.

    If G8 = “E” and if F8 = “L” and E8 is >=20 Copy A8:G8 and paste to sheet tab Sheet40.

    When at anytime “D” is in G8, do nothing.

    These conditions would be for each row from 8 – 3000 down the page

    Thank you guys!

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: statements to copy and paste from one sheet to another

    Does this work for you?

    Please Login or Register  to view this content.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417

    Re: statements to copy and paste from one sheet to another

    This code doesn't run. I don't get any error. Maybe I'm doing something wrong. I assigned the code to a button on Sheet40. Does it matter?

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: statements to copy and paste from one sheet to another

    Yes, that matters. You should be on whichever sheet you want to run it for.
    ... Actually, now that I reread your original request, did you want it to run on all even sheet numbers?

  5. #5
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417

    Re: statements to copy and paste from one sheet to another

    Just the sheets listed. There are more sheets in the workbook that don't apply.

  6. #6
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: statements to copy and paste from one sheet to another

    Ok, let me know how this works for you. Put the code in a standard module:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417

    Re: statements to copy and paste from one sheet to another

    Sorry.. I screwed up. I was looking at the VBAProject when I listed the names of the sheets.. The sheets are actualy named sheets. Do you need the name of each sheet. I can't believe I listed Sheet2...etc.

  8. #8
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: statements to copy and paste from one sheet to another

    If the sheets will always have the VBAProject names of 2 - 38 (evens only) then it is actually easier. Just change to this:

    Please Login or Register  to view this content.
    Otherwise you can name each sheet in the array manually. For example:

    arrSht(1) = "Name1"
    arrSht(2) = "Name2"
    ...

  9. #9
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417

    Re: statements to copy and paste from one sheet to another

    The original code works except it does not look in G for "D" nor does it include "L" in F.

    If G8 = “E” and if F8 = “H” and E8 is >=10 Copy A8:G8 and paste to sheet tab Sheet40.

    If G8 = “E” and if F8 = “E” and E8 is >=1 Copy A8:G8 and paste to sheet tab Sheet40.

    If G8 = “E” and if F8 = “L” and E8 is >=20 Copy A8:G8 and paste to sheet tab Sheet40.

    When at anytime “D” is in G8, do nothing.

    Please Login or Register  to view this content.
    I don't know what to do... Maybe write 2 codes and use Application.Run - the other macro name or something

  10. #10
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: statements to copy and paste from one sheet to another

    I didn't read your previous thread. Does my code not work?

  11. #11
    Forum Contributor
    Join Date
    04-23-2007
    Location
    Texas
    Posts
    417

    Re: statements to copy and paste from one sheet to another

    No, I can't get it to work.

  12. #12
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: statements to copy and paste from one sheet to another

    Well, what line produces an error?

+ 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