+ Reply to Thread
Results 1 to 13 of 13

Conditional copy to another workbook.

  1. #1
    Registered User
    Join Date
    03-29-2012
    Location
    St Louie Mo
    MS-Off Ver
    Excel 2010
    Posts
    25

    Conditional copy to another workbook.

    Hello again kind folks.Ive ask this question before but I still dont have the answer that works.I've used a helper column(K) to help me. I need something that looks to column K,its looking for one of three conditions.First,if blank do nothing.Second if a number 1 is present copy cells A:J to workbook named "WIP".Third,if the number 2 is present copy A:J to workbook named "Finished Jobs".CFW#1.xlsm

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Conditional copy to another workbook.

    Would the workbooks WIP & Finished jobs be open at the time of running the macro? Or are you talking about worksheets?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Conditional copy to another workbook.

    this macro copy to worksheets "WIP" and "Finished Jobs"
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-29-2012
    Location
    St Louie Mo
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Conditional copy to another workbook.

    Well I would think they would NOT be open .I was hoping to have to separate workbooks.But its not absolutely necessary.Thanks patel I'll give that a try.
    Last edited by Lou54; 08-17-2012 at 03:21 PM.

  5. #5
    Registered User
    Join Date
    03-29-2012
    Location
    St Louie Mo
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Conditional copy to another workbook.

    Patel I get an error message.
    Runtime error"9"
    Subscript out of range
    I thought maybe its because i dont have the other two sheets named but I tried to name it and it still gives me the same error.Thanks greatly for all the help....Lou

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Conditional copy to another workbook.

    Subscript out of range error is always associated with the sheet name. Please check that the sheet names match with the code with regard to spelling and case.

  7. #7
    Registered User
    Join Date
    03-29-2012
    Location
    St Louie Mo
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Conditional copy to another workbook.

    Thanks patel45 and arlu after I changed the names of the worksheets that code worked great.Thanks for your kind help.....Lou

  8. #8
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Conditional copy to another workbook.

    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  9. #9
    Registered User
    Join Date
    03-29-2012
    Location
    St Louie Mo
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Conditional copy to another workbook.

    patel45 Im not sure this is allowed but after marking this solved I got to wondering if its possible for you to go over the code you've written.Such as how I could alter it to look in other books and how I might change the code to put what it finds in another workbook instead of a different sheet in the same workbook.Things like were and how I could alter it to look in another place for this information and how to direct it to another location.Things like that.I appeciate greatly all your help.....Lou
    Last edited by Lou54; 08-22-2012 at 08:22 AM.

  10. #10
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Conditional copy to another workbook.

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    03-29-2012
    Location
    St Louie Mo
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Conditional copy to another workbook.

    Hi Patel45 and thanks again for your help.When I tired to run the second formula I get a "Run Time Error 1004"

  12. #12
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Conditional copy to another workbook.

    what do you mean for the second formula ? be more precise.
    did you change the line: myPath = "D:\DATA\test\" ?
    Last edited by patel45; 08-23-2012 at 02:11 AM.
    If solved remember to mark Thread as solved

  13. #13
    Registered User
    Join Date
    03-29-2012
    Location
    St Louie Mo
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Conditional copy to another workbook.

    Im sorry, but no I havent changed anything.I meant the second set of code you put on this thread is all.Thanks for your help....Lou

+ 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