+ Reply to Thread
Results 1 to 37 of 37

Transfer Data From Workbook To Workbook

Hybrid View

  1. #1
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Dave

    Silly me - forgot to find things in the right sheet.

    try this

    Sub ExportIt()
      Workbooks.Open (ThisWorkbook.Path & "\master rota.xls")
      Set outsh = Sheets(ThisWorkbook.Sheets("rota").Range("A4").Value)
      
      ThisWorkbook.Activate
      For Each ce In Range("F6:F" & Cells(Rows.Count, "F").End(xlUp).Row)
        Set findit = outsh.Range("F:F").Find(what:=ce.Value)
        For j = 7 To Cells(2, Columns.Count).End(xlToLeft).Column
          outcol = Evaluate("=match(" & Format(CDate(Cells(2, j)), 0) & ",'[master rota.xls]" & outsh.Name & "'!2:2,0)")
          outsh.Cells(findit.Row, outcol).Value = Cells(ce.Row, j).Value
        Next j
      Next ce
      
    End Sub
    rylo

  2. #2
    Forum Contributor
    Join Date
    08-22-2008
    Location
    S-o-t
    MS-Off Ver
    Office 2000 & 2010
    Posts
    166
    Hi

    This is looking great will need to run some more test but so far i'm having no problems.

    Dave

  3. #3
    Forum Contributor
    Join Date
    08-22-2008
    Location
    S-o-t
    MS-Off Ver
    Office 2000 & 2010
    Posts
    166
    Thanks for your help so Far

    Because i have Data under Row F50 on the rota sheet(not the example sheet i posted) i keep getting an error its todo with the End up statement but i'm not sure how to set the range.

    Dave

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Dave

    I see what you mean now.

    Change the for each row to

    For Each ce In Range("F6", Range("F6").End(xlDown))
    It does assume that there will be a break between the last of the staff ids and any other data...


    rylo

  5. #5
    Forum Contributor
    Join Date
    08-22-2008
    Location
    S-o-t
    MS-Off Ver
    Office 2000 & 2010
    Posts
    166
    Hi

    This is now working so Far

    Thanks for your help

    Dave

  6. #6
    Forum Contributor
    Join Date
    08-22-2008
    Location
    S-o-t
    MS-Off Ver
    Office 2000 & 2010
    Posts
    166
    Hi again

    There will be some blank Rows in between some of the ID Numbers in the rota sheet so i'm not sure that end up or end down will be ok.

    Dave

  7. #7
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Dave

    So could you use the fixed range F6:F49 and only action non blank cells????


    rylo

+ 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