Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Copy Pivot Table Data to Another Worksheet in Same Workbo jeannie v Excel Worksheet Functions 8 March 11th 14 09:15 AM
Adding a new worksheet to a workbook at the end of existing workbo CBedford12 Excel Discussion (Misc queries) 2 August 21st 09 03:34 PM
Copy worksheet to 2nd workbook but have no reference to 1st workbo i4004 Excel Discussion (Misc queries) 8 June 24th 08 02:04 AM
Link from worksheet in one workbook to worksheet in another workbo Pam Excel Discussion (Misc queries) 1 November 3rd 06 06:27 PM
Link from worksheet in one workbook to worksheet in another workbo Pam New Users to Excel 1 November 3rd 06 06:27 PM


All times are GMT +1. The time now is 08:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"