Yes, I need to copy only one worksheet. I have 85 workbooks each month
that arrive from different office locations. Each wkbk contains 10
worksheets. I need to copy worksheet(6) from each of the 85 workbooks
into a "Monthly Summary" workbook. Since Worksheet(6) has the same
name in each of the 85 individual office workbooks, I want to use the
office number ("000") that appears in cell C2 of the sheet being
copied as a naming convention in my "Monthly Summary" workbook.
I noticed after the sheets are copied, they retain their formulas with
specific references. What I only need are the cell values. How can I
copy the sheets with only values rather than the formulas?
Also, where would I place the the following code to extend "pop-up
box"/GetFileName functionality. The 85 workbooks are in folders named
for each month (i.e., path is "C:\Data\DataFiles\Sept\(my 85 *.xls
files)".
varr = Application.GetOpenFilename(filefilter:="Excel Files, *.xls", _
MultiSelect:=True)
If IsArray(varr) Then
For i = LBound(varr) To UBound(varr)
Set wkbk = Workbooks.Open(varr(i))
wkbk.Worksheets.Copy After:=ThisWorkbook. _
Worksheets(ThisWorkbook.Worksheets.Count)
wkbk.Close SaveChanges:=False
Next
End If
_____________________________________________________________________________
Here's what I have so far:
Option Explicit
Sub GetSheets()
Dim sPath As String, i As Long
Dim varr As Variant
Dim wkbk As Workbook
sPath = "C:\Data\DataFiles\test\"
varr = Array("Data1.xls", "Data2.xls", "Data3.xls")
For i = LBound(varr) To UBound(varr)
Set wkbk = Workbooks.Open(sPath & varr(i))
With wkbk.Worksheets(6)
On Error Resume Next
.Name = .Range("c2").Value
If Err.Number <> 0 Then
MsgBox .Name & " Couldn't be renamed"
Err.Clear
End If
On Error GoTo 0
.Copy After:=ThisWorkbook. _
Worksheets(ThisWorkbook.Worksheets.Count)
End With
wkbk.Close SaveChanges:=False
Next
End Sub
_____________________________________________________________________________
I sincerely appreiciate your willingness to offer assistance. I have
re-read and editted my post several times before posting to try and
explain my objectives. Once again, thanks...you guys are outstanding.
Kind Regards,
Mike Taylor