Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default FYI: One macro really helped for capturing data from multiple workbook stored in a specific folder to one excel file only

Sub Use_of_FileSearch()



Dim MyDumpFiles As String
Dim MyPath As String
Set fs = Application.FileSearch

MyPath = "C:\Count" 'Change the folder location'

With fs

.LookIn = MyPath
.SearchSubFolders = True
.Filename = "*.xls"

If .Execute() 0 Then
MsgBox "Number of excel file(s) found a " & .FoundFiles.Count

For i = 1 To .FoundFiles.Count
MyDumpFiles = .FoundFiles(i)
Workbooks.Open MyDumpFiles
Worksheets(1).Activate
Range("A1:C10").Copy
ActiveWindow.ActivateNext
Worksheets(1).Activate
Range("A1:C10").PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Rows("1:11").Select
Selection.Insert Shift:=xlDown
ActiveWindow.ActivateNext
ActiveWorkbook.Close Savechanges = False

Next i

Else

MsgBox "No Excel File(s) Found"

End If

End With




End Sub

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
can excel automaticaly open file from specific folder sand Excel Discussion (Misc queries) 1 July 7th 07 03:56 PM
Capture data in one 'destination' file from varied 'source' file stored in one single folder. Smits Excel Programming 4 October 7th 06 12:35 PM
Call macro stored in Excel workbook from Outlook's macro Gvaram Excel Programming 0 October 4th 06 05:47 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven Excel Discussion (Misc queries) 1 January 24th 06 03:28 PM
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? Raven[_2_] Excel Programming 1 January 24th 06 04:23 AM


All times are GMT +1. The time now is 09:51 PM.

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

About Us

"It's about Microsoft Excel"