+ Reply to Thread
Results 1 to 2 of 2

DAta transfer

  1. #1
    Registered User
    Join Date
    09-13-2009
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    7

    Unhappy DAta transfer

    Hi ,

    I have the two files. in BOOK1.xlsone file I have data in table format with certain colums....
    i want tranfer table data to check.xls file to paste in certain cells.

    i created the macro, however i'm getting error meesge as Runtime error 9, Subscript out of range.
    please help me out.


    Sub chekcon()
    Dim check, book1 As Workbook
    Dim wk1, wk2 As Worksheet
    Dim i As Integer
    Dim lstrw As Integer
    Set book1 = ThisWorkbook
    Set check = Workbooks("Z:\66205_TEMPLATES_20996\Check Control Processing Form-XX-XX-XXXX.XLS")
    Set wk1 = book1.Worksheets("sheet1")
    Set wk2 = check.Worksheets("sheet1")
    lstrw = book1.Cells(65530, 1).End(xlUp).Row
    For i = 2 To lstrw
    book1.Cells(i, 1).Value = check.Cells(3, 3).Value
    book1.Cells(i, 2).Value = check.Cells(11, 5).Value
    book1.Cells(i, 3).Value = check.Cells(1, 4).Value
    book1.Cells(i, 4).Value = check.Cells(1, 10).Value
    book1.Cells(i, 5).Value = check.Cells(13, 5).Value
    book1.Cells(i, 5).Value = check.Cells(3, 6).Value
    book1.Cells(i, 6).Value = check.Cells(11, 10).Value
    book1.Cells(i, 7).Value = check.Cells(3, 11).Value
    book1.Cells(i, 8).Value = check.Cells(43, 4).Value
    book1.Cells(i, 9).Value = check.Cells(45, 4).Value
    fn = book1.Cells(i, 10).Value
    check.SaveAs Filename:="Z:\66205_TEMPLATES_20996\" & fn
    Next i
    End Sub


    Attached Files Attached Files
    Last edited by karuna85.k; 12-19-2010 at 07:17 AM. Reason: solved

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: DAta transfer

    You are getting an error on this line

    Please Login or Register  to view this content.
    because there is no file open called "Z:\66205_TEMPLATES_20996\Check Control Processing Form-XX-XX-XXXX.XLS".

    Workbooks is a collection, and if you put an index in it that doesn't exist you get a subscript out of range.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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