Macro for excel 2007

February 12, 2010 at 01:44:08
Specs: Windows XP

I need help in developing a macro for excel 2007. There are few excel files in a directory, the macro should consolidate all the data in these files into one single file in the same directory.

Please assist.


See More: Macro for excel 2007

Report •

February 15, 2010 at 09:29:03
Quick and dirty:
Sub something()
  Dim f As Object, fso As Object
  Set fso = CreateObject("Scripting.filesystemobject")
  With fso.opentextfile("list.txt", 2, True)
    For Each f In fso.Getfolder(".").Files
      If fso.GetExtensionName(f) = "xls" _
        Or fso.GetExtensionName(f) = "xlsx" Then _
          .WriteLine f
    Next f
  End With
End Sub

Report •
Related Solutions

Ask Question