Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I am trying to modify existing code to accomplish the following: Copy range bp18:bu18 from sheet1 of a daily file and paste to a new montyhly summary sheet B2:B6, with a new row for for each day. There are 2 files created each day myfileyyyymmddA.xls and myfileyyyymmddP.xls. I would like to only copy from the "A" file. This is the code I have but it copies A and P and is pasting in Column A only. Sub Summary() Dim myCell As Range With Application .DisplayAlerts = False .EnableEvents = False .ScreenUpdating = False End With With Application.FileSearch .NewSearch 'Copy or move this workbook to the folder with 'the files that you want to summarize .LookIn = ThisWorkbook.Path .FileType = msoFileTypeExcelWorkbooks If .Execute() 0 Then Set Basebook = ThisWorkbook For i = 1 To .FoundFiles.Count If .FoundFiles(i) < ThisWorkbook.FullName Then Set myBook = Workbooks.Open(.FoundFiles(i)) myBook.Worksheets("sheet1").Select For Each myCell In _ Intersect(ActiveSheet.Range("BP18:BU18"), ActiveSheet.UsedRange) If myCell.Value < 0 Then ThisWorkbook.Worksheets(1). _ Range("A65536").End(xlUp)(2).Value = _ myCell.Value End If Next myCell myBook.Close End If Next i End If End With With Application .DisplayAlerts = True .EnableEvents = True .ScreenUpdating = True End With Basebook.SaveAs Application.GetSaveAsFilename End Sub Thanks! Al |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy workbook, don't copy macro | Excel Discussion (Misc queries) | |||
macro to copy | Excel Discussion (Misc queries) | |||
Copy a macro? | Excel Discussion (Misc queries) | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming |