This is mostly plagiarized from Excel's VBA help file
It assumes 1) that all your 41 named tabs are in the same workbook, 2) you
paste this code into a module in that workbook & run the code when that
workbook is active, 3) the CSV files are in c:\CSV files\ and 4) you are
going to paste the data starting with cell A2
For help on where & how to paste VBA code:
http://www.cpearson.com/excel/codemods.htm
For information on installing the code see
Getting Started with Macros and User Defined Functions
http://www.mvps.org/dmcritchie/excel/getstarted.htm
Here's the code
---------------------------------------------------------------------------
Sub OpenCSV()
Dim i As Integer
' change this next line to reflect the actual directory
Const strDir = "c:\csv files\"
Dim ThisWB As Workbook
Dim wb As Workbook
Dim ws As Worksheet
Dim strWS As String
Set ThisWB = ActiveWorkbook
Set fs = Application.FileSearch
With fs
.LookIn = strDir
.Filename = "*.csv"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
Set wb = Workbooks.Open(.FoundFiles(i))
strWS = wb.Sheets(1).Name
wb.Sheets(1).UsedRange.Copy (ThisWB.Worksheets(strWS).Range("A2"))
wb.Close False
Next i
Else
MsgBox "There were no files found."
End If
End With
End Su