Below is the code where I am trying to copy the data in multiple Excel workbook data in one folder to one excel sheet this code is working fine in MS 2003 but it is not at all working in ms 2007
Can you please help me to debug this code to run in MS 2007
Thanks for the help in AdvanceHTML Code:Sub Gather() Application.ScreenUpdating = False Dim Master As Worksheet Dim strName As String strName = InputBox(Prompt:="Select Sheet To perfrom selected opeartion.", _ Title:="Sheet NAME", Default:="Sheet1") Debug.Print (strName) Set Master = Worksheets(strName) Master.Rows.Delete Master.Columns.Delete 'MsgBox "Point to the folder containing all the files in the next dialog - then click Cancel" 'Application.GetOpenFilename On Error Resume Next With Application.FileSearch .NewSearch .LookIn = "C:\Excel Sheets" .FileType = msoFileTypeExcelWorkbooks .Execute 'For i = 1 To .FoundFiles.Count For i = 1 To 19 Workbooks.Open .FoundFiles(i), False, True Err.Clear Sheets("Sheet1").Activate If Err.Number <> 0 Then ActiveWorkbook.Close False GoTo NextWB End If l = Master.UsedRange.Rows.Count ActiveSheet.UsedRange.Copy Master.Cells(l + 1, 1).PasteSpecial Application.CutCopyMode = False 'ActiveWorkbook.Close False NextWB: Next End With Range("A1").Select Application.ScreenUpdating = True MsgBox "Data is copied to selelcted sheet - " & strName, vbInformation End Sub
Regards
Shrinivas





Reply With Quote