LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Sub ProcessFiles()
Dim oThis As Worksheet
Dim oFSO As Object
Dim oFiles As Object
Dim oFile As Object
Dim sFolder As String
Dim oFolder As Object
Dim i As Long

Application.ScreenUpdating = False

Set oThis = ActiveSheet
Set oFSO = CreateObject("Scripting.FileSystemObject")
sFolder = "C:\MyTest"

If sFolder < "" Then
Set oFolder = oFSO.GetFolder(sFolder)
Set oFiles = oFolder.Files
For Each oFile In oFiles
If oFile.Type = "Microsoft Excel Worksheet" Then
i = i + 1
Workbooks.Open Filename:=oFile.Path
With ActiveWorkbook
oThis.Cells(i, "A").Value =
..ActiveSheet.Range("A1").Value
.Close savechanges:=False
End With
End If
Next oFile
End If ' sFolder < ""

Application.ScreenUpdating = True

End Sub

--
HTH

Bob Phillips

"nc" wrote in message
...
Hi

I am using Excel 2003

I would like to use macro to do the following.

I have a few Excel files in a folder and I would like to copy the same

range
from each file, and paste it in a specific workbook/template.

Please help.



 
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
Is there an easy way to copy my Intuit Quicken files to Excel? Kelowna Excel Discussion (Misc queries) 2 April 19th 05 03:54 PM
How do i copy columns of data in notepad into microsoft excel? JP New Users to Excel 2 February 10th 05 09:47 PM
How do i copy columns of data in notepad into excel? JJ Excel Discussion (Misc queries) 1 February 10th 05 09:21 PM
Excel Files Won't Open From Shortcut ConfusedNHouston Excel Discussion (Misc queries) 5 December 31st 04 06:25 PM
Why do my links break when I burn multiple Excel files to a CD? akrr-rasmussen Excel Worksheet Functions 1 November 17th 04 02:39 AM


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