Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Gathering data from all xl files in a folder

Unfortunately I haven't used VBA in several years. I used to know how to do
this. I have a folder where a daily report will be placed in the form of a
new Excel sheet every day. The only files in the folder will be these daily
reports. I want to monitor certain values on that report, so I need to
import the data from a few cells an put into a different spreadsheet. (Is it
easier for the "master file" to be in the same folder, or a different
folder?) The reports have Macro's and links, so when I open the file there
will be two popups (enable Macro, and update sheet). I don't need to enable
the Macro nor update the sheet. I need the data from cells B13 and B26 in
the report, put into columns for me to plot. Could someone help me out?
Also, the file names will indicate date or order. Will the files in the
folder be accessed in a specified order, or will I have to extract the data
from within the report?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Gathering data from all xl files in a folder

Try this add-in
http://www.rondebruin.nl/merge.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"Okieviking" wrote in message ...
Unfortunately I haven't used VBA in several years. I used to know how to do
this. I have a folder where a daily report will be placed in the form of a
new Excel sheet every day. The only files in the folder will be these daily
reports. I want to monitor certain values on that report, so I need to
import the data from a few cells an put into a different spreadsheet. (Is it
easier for the "master file" to be in the same folder, or a different
folder?) The reports have Macro's and links, so when I open the file there
will be two popups (enable Macro, and update sheet). I don't need to enable
the Macro nor update the sheet. I need the data from cells B13 and B26 in
the report, put into columns for me to plot. Could someone help me out?
Also, the file names will indicate date or order. Will the files in the
folder be accessed in a specified order, or will I have to extract the data
from within the report?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Gathering data from all xl files in a folder

Place the files in a different folder and try the below macro from your
master workbook..The values from these two cells will be picked up and
updated in the active sheet for the master workbook ColA/ColB

Sub Macro()

Dim strFile As String, strFolder As String, lngRow As Long
Dim ws As Worksheet, wb As Workbook

strFolder = "c:\" 'Adjust to suit
lngRow = 1 'Starting row number in master file
Set ws = ActiveSheet
Application.ScreenUpdating = False
strFile = Dir(strFolder & "*.xls", vbNormal)
Do While strFile < ""
Set wb = Workbooks.Open(strFile, ReadOnly = True)
ws.Range("A" & lngRow) = wb.ActiveSheet.Range("B13").Value
ws.Range("A" & lngRow) = wb.ActiveSheet.Range("B26").Value
lngRow = lngRow + 1
wb.Close False
Set wb = Nothing
strFile = Dir
Loop
Application.ScreenUpdating = True

End Sub



If this post helps click Yes
---------------
Jacob Skaria


"Okieviking" wrote:

Unfortunately I haven't used VBA in several years. I used to know how to do
this. I have a folder where a daily report will be placed in the form of a
new Excel sheet every day. The only files in the folder will be these daily
reports. I want to monitor certain values on that report, so I need to
import the data from a few cells an put into a different spreadsheet. (Is it
easier for the "master file" to be in the same folder, or a different
folder?) The reports have Macro's and links, so when I open the file there
will be two popups (enable Macro, and update sheet). I don't need to enable
the Macro nor update the sheet. I need the data from cells B13 and B26 in
the report, put into columns for me to plot. Could someone help me out?
Also, the file names will indicate date or order. Will the files in the
folder be accessed in a specified order, or will I have to extract the data
from within the report?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Gathering data from all xl files in a folder

Thanks Jacob! It works great! However, the people posting the reports save
it on different worksheets as the active sheet. How do I specify I want the
data from sheet 1?

"Jacob Skaria" wrote:

Place the files in a different folder and try the below macro from your
master workbook..The values from these two cells will be picked up and
updated in the active sheet for the master workbook ColA/ColB

Sub Macro()

Dim strFile As String, strFolder As String, lngRow As Long
Dim ws As Worksheet, wb As Workbook

strFolder = "c:\" 'Adjust to suit
lngRow = 1 'Starting row number in master file
Set ws = ActiveSheet
Application.ScreenUpdating = False
strFile = Dir(strFolder & "*.xls", vbNormal)
Do While strFile < ""
Set wb = Workbooks.Open(strFile, ReadOnly = True)
ws.Range("A" & lngRow) = wb.ActiveSheet.Range("B13").Value
ws.Range("A" & lngRow) = wb.ActiveSheet.Range("B26").Value
lngRow = lngRow + 1
wb.Close False
Set wb = Nothing
strFile = Dir
Loop
Application.ScreenUpdating = True

End Sub



If this post helps click Yes
---------------
Jacob Skaria


"Okieviking" wrote:

Unfortunately I haven't used VBA in several years. I used to know how to do
this. I have a folder where a daily report will be placed in the form of a
new Excel sheet every day. The only files in the folder will be these daily
reports. I want to monitor certain values on that report, so I need to
import the data from a few cells an put into a different spreadsheet. (Is it
easier for the "master file" to be in the same folder, or a different
folder?) The reports have Macro's and links, so when I open the file there
will be two popups (enable Macro, and update sheet). I don't need to enable
the Macro nor update the sheet. I need the data from cells B13 and B26 in
the report, put into columns for me to plot. Could someone help me out?
Also, the file names will indicate date or order. Will the files in the
folder be accessed in a specified order, or will I have to extract the data
from within the report?

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
Extracting data from some files in folder Alf[_6_] Excel Programming 4 June 11th 06 10:21 AM
getting data from all files from a folder. J_J[_2_] Excel Programming 4 April 20th 06 08:47 AM
Copy same data from all files in folder BENNY Excel Programming 1 June 18th 04 10:52 PM
Gathering info from saved files rxwillow[_2_] Excel Programming 1 January 19th 04 01:41 AM
Gathering info from a set of excel files Remy[_2_] Excel Programming 0 October 31st 03 02:54 AM


All times are GMT +1. The time now is 07: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"