LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 363
Default Copy Macro

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy workbook, don't copy macro CongroGrey Excel Discussion (Misc queries) 1 June 13th 08 04:56 PM
macro to copy DTruong Excel Discussion (Misc queries) 0 August 4th 06 03:44 PM
Copy a macro? Melissa Excel Discussion (Misc queries) 2 July 26th 06 08:32 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM


All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"