+ Reply to Thread
Results 1 to 13 of 13

Conditional copy to another workbook.

Hybrid View

  1. #1
    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"
    Sub a()
    Set sh1 = Sheets(1)
    Set shWIP = Sheets("WIP")
    Set shFIN = Sheets("Finished Jobs")
    LR = sh1.Range("A" & Rows.Count).End(xlUp).Row
    WIPstartrow = 2
    FINstartrow = 2
    With sh1
     For j = 2 To LR
        If .Cells(j, 11).Value = 1 Then
          .Range(.Cells(j, 1), .Cells(j, 10)).Copy shWIP.Cells(WIPstartrow, 1)
          WIPstartrow = WIPstartrow + 1
        End If
        If .Cells(j, 11).Value = 2 Then
          .Range(.Cells(j, 1), .Cells(j, 10)).Copy shFIN.Cells(FINstartrow, 1)
          FINstartrow = FINstartrow + 1
        End If
     Next
    End With
    End Sub

  2. #2
    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

+ 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