Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to Copy Pivot Table Data to Another Worksheet in Same Workbo | Excel Worksheet Functions | |||
Adding a new worksheet to a workbook at the end of existing workbo | Excel Discussion (Misc queries) | |||
Copy worksheet to 2nd workbook but have no reference to 1st workbo | Excel Discussion (Misc queries) | |||
Link from worksheet in one workbook to worksheet in another workbo | Excel Discussion (Misc queries) | |||
Link from worksheet in one workbook to worksheet in another workbo | New Users to Excel |