Stormseed
Banned
- Joined
- Sep 18, 2006
- Messages
- 3,274
guys...
cant figure out what exactly this code is doing? My problem is - I have different sheets in different workbooks. I want to transfer each and every sheet from these different workbooks into one single workbook. I have the code which I know (mentioned below) does meet my requirement to a certain extent but am unable to figure out wat exactly happens. If it does - then where do I put the code? Is it that I need to paste it as a module in that single workbook where I want all the sheets to be gathered?
Code:
Sub allWorkbook()
'Standard Module code, like: Module1!
Dim f%, Wb
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
'Option: Search Sub-Folders as well?
.SearchSubFolders = False 'Option: True or False!
'Option Current Folder or a defined folder?
'.LookIn = CurDir
'Or
.LookIn = "C:\your directory"
'Option: Only Search this type of file?
.Filename = "*.xls"
.Execute
For f = 1 To .FoundFiles.Count
Set Wb = Workbooks.Open(Filename:=.FoundFiles(f))
'*************************************************************************
'Add your code here!
'*************************************************************************
ActiveWorkbook.Save
ActiveWorkbook.Close
Next f
End With
Application.ScreenUpdating = True
End Sub
I do understand that the code is asking for a folder where it can search that xls files but am in a little mess ! Please help !
thanks so much for your help !
cant figure out what exactly this code is doing? My problem is - I have different sheets in different workbooks. I want to transfer each and every sheet from these different workbooks into one single workbook. I have the code which I know (mentioned below) does meet my requirement to a certain extent but am unable to figure out wat exactly happens. If it does - then where do I put the code? Is it that I need to paste it as a module in that single workbook where I want all the sheets to be gathered?
Code:
Sub allWorkbook()
'Standard Module code, like: Module1!
Dim f%, Wb
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
'Option: Search Sub-Folders as well?
.SearchSubFolders = False 'Option: True or False!
'Option Current Folder or a defined folder?
'.LookIn = CurDir
'Or
.LookIn = "C:\your directory"
'Option: Only Search this type of file?
.Filename = "*.xls"
.Execute
For f = 1 To .FoundFiles.Count
Set Wb = Workbooks.Open(Filename:=.FoundFiles(f))
'*************************************************************************
'Add your code here!
'*************************************************************************
ActiveWorkbook.Save
ActiveWorkbook.Close
Next f
End With
Application.ScreenUpdating = True
End Sub
I do understand that the code is asking for a folder where it can search that xls files but am in a little mess ! Please help !
thanks so much for your help !