LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Data transfer, from template to main speadsheet

danish,

The double stops is an artifact introduced by some newsreaders... but you
did the right thing to take one out. Anyway, to process mutliple files, you
can do something like this, assuming that each of the data files is a single
sheet, or if the active sheet is the desired sheet. Uncomment out the line

'myB.Worksheets("Sheet Name with the data").Select

and change the sheet name if that is not the case:

Sub PullData2()
Dim myR As Long
Dim mySR As Range
Dim myD As Range
Dim myArr As Variant
Dim i As Integer
Dim myB As Workbook

myArr = Application.GetOpenFilename(, , "Select all the workbooks", , True)

For i = LBound(myArr) To UBound(myArr)
Set myB = Workbooks.Open(myArr(i))
'myB.Worksheets("Sheet Name with the data").Select
'Code from here is the same as what you had previously
Set myD = Range("B1")
Set mySR = ThisWorkbook.Worksheets("Summary Sheet").Range("A:A")

myR = WorksheetFunction.Match(CDbl(myD.Value), mySR, False)
With ThisWorkbook.Worksheets("Summary Sheet")
..Range("B" & myR).Formula = Range("C1").Value
..Range("C" & myR).Formula = Range("F16").Value
..Range("D" & myR).Formula = Range("H3").Value
..Range("E" & myR).Formula = Range("I9").Value
..Range("F" & myR).Formula = Range("B12").Value
End With
'End of code from before

myB.Close False
Next i
End Sub

HTH,
Bernie
MS Excel MVP

"danish404" wrote in message
...
Berine,
sorry for not replying quickly. Tried this out and it works a treat,
changed the variables, added a few more lines does the job fantastic!
(did
remove one of the stops at the beginning of this line "..Range("B" &
myR).Formula = Range("C1").Value" but that might be due to my version of
excel, but I'm not sure 2003)

one additional question if I may, and if you have time, how do i make it
open more that one input sheet at a time and work its magic? (they all
have
different names)

but thats for all your help is solving this, great job!



 
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
Getting Data from Excel Graph onto New Speadsheet Lumo Charts and Charting in Excel 0 May 18th 08 02:42 PM
How do I copy data from main frame computer and keep data in cell Doug Excel Worksheet Functions 1 May 30th 06 05:15 PM
userform listbox cannot get listbox.value to transfer back to main sub [email protected] Excel Programming 1 May 17th 06 09:44 PM
Data transfer from a template to a workbook Nick Excel Worksheet Functions 0 April 20th 06 05:26 PM
Access from add_in userform to main template userform.... Ajit Excel Programming 1 November 18th 04 05:15 PM


All times are GMT +1. The time now is 02:46 AM.

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"