LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Import data from multiple excel files

Happy Holidays to all...

I have a need to do the following:

123 different workbooks, each with a sheet named FORM. They all reside
on a network driver in the same folder.

The FORM worksheets are set-up the same, however, there are varying
rows of data between the sheets.

I need to copy all the data that is in Column B, and Column Q to a
"master" workbook.
The data I need begins at row 20, and will always start at row 20.

I have read many posts about simialr requests, and have found many
differnt examples, but am just not "getting" it. Any help, or pointers
are appreciated.

I have the following code, that will look in a folder, and tell me how
many SS are there and copy all the SS to one workbook, (thanks to this
usegroup), and thought I could modify it to work for what I need,
however, I am stuck...any help is appreciated. Thanks and hope
everyone has a nice holiday!!!

begin code snip:



Sub Testing()
Dim basebook As Workbook
Dim mybook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim i As Long
Dim lr As Long
Dim lastcellinC As Long
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
.LookIn =
"\\ms024user1\DEPTGRPS\Marketing\Market\iDeals\Wor k_Folder\"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
Set basebook = ThisWorkbook
For i = 1 To .FoundFiles.Count
Set mybook = Workbooks.Open(.FoundFiles(i))
lr = LastRow(basebook.Worksheets(1)) + 1
lastcellinC = mybook.Worksheets(1).Range("Q" &
Rows.Count).End(xlUp).Row
Set sourceRange = mybook.Worksheets(1).Range("a20:Q" &
lastcellinC)
Set destrange = basebook.Worksheets(1).Cells(lr, 1)
sourceRange.Copy destrange
basebook.Worksheets(1).Cells(lr, 1).Value = mybook.Name
mybook.Close
Next i
End If
End With
Application.ScreenUpdating = True
End Sub


Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

 
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
Import Multiple XML Files into Excel Mungkol Excel Discussion (Misc queries) 3 January 22nd 09 01:37 PM
import multiple csv files into excel 2007 Annie - torston Excel Discussion (Misc queries) 1 January 15th 09 06:24 AM
How can i import multiple .csv files into Excel for analysis? Spanic Excel Programming 2 June 2nd 05 08:59 PM
Import of multiple .CSV files into Excel Ayato[_10_] Excel Programming 0 July 8th 04 06:02 PM
Excel VBA - Import Data for manipulation from multiple text files ZX210 Excel Programming 2 January 13th 04 02:38 PM


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