![]() |
retrieving data from one workbook to a worksheet in another workbo
I am trying to use the following program to retrieve data from a worksheet in
one workbook to a worksheet in a different workbook, however, it doesn't seem to work. Can anyone tell me what's wrong plz? i am trying to retrive data from the target tab named "Supervisor Instructions", in the target file "PushInstructions.xls" to the source tab "EXT CO", in the source file "Extraction Op.xls" ------- Private Sub Retrieve_Click() MsgBox "Hello" Call WriteInstructions("H:\PushInstructions.xls", "Supervisor Instructions", "EXT CO", 8, 10, 58, 10) End Sub ----------------- Public Sub WriteInstructions(TGTWKBook, TGtTabName, SrcTabName, startcell1, endcell1, startcell, endcell) Workbooks.Open (TGTWKBook) entrydata = ThisWorkbook.Worksheets(SrcTabName).Range(("B" & startcell), "B" & (startcell + endcell)).Value j = 1 Do Until (j endcell) MsgBox "Value of I is " & j & " AND Instruct data is " & entrydata(j, 1) & "spreadsheet name:" & SrcTabName ActiveWorkbook.Worksheets(TGtTabName).Cells(startc ell1, 2).Value = entrydata(j, 1) j = j + 1 startcell1 = startcell1 + 1 Loop ' MsgBox "startcell1 is" & startcell1 & " end cell1 is " & endcell1 & " sheetname " & tabname While (startcell1 <= endcell1) ActiveWorkbook.Worksheets(TGtTabName).Cells(startc ell1, 2).Value = "" startcell1 = startcell1 + 1 Wend ActiveWorkbook.Save Application.DisplayAlerts = False ActiveWorkbook.Close True End Sub -------- Help is greatly appreciated Thanks |
All times are GMT +1. The time now is 12:39 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com