Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Yo ucan get data out of a workbook without opening each workbook but that is much harder to write that code and since you boss is breathinhg down your neck I would recommend the code below. Changge the folder name in the Code below. The code is taking every file in the Folder named "RetailProjectLog*.xls" and ignoring the date. I would have to mdofiy the code if you are looking for a particular date. Sub UpdateRCTBks() Folder = "c:\temp\" FName = Dir(Folder & "RetailProjectLog*.xls") Do While FName < "" Set RPLbk = Workbooks.Open(Filename:=Folder & FName) Set RPLSht = RPLbk.Sheets("Sheet1") LastRow = RPLSht.Range("A" & Rows.Count).End(xlUp).Row For RowCount = 4 To LastRow Locale = RPLSht.Range("A" & RowCount) Set DestSht = ThisWorkbook.Sheets(Locale) With DestSht LastRow = .Range("A" & Rows.Count).End(xlUp).Row NewRow = LastRow + 1 If NewRow < 12 Then NewRow = 12 End If End With RPLSht.Range("B" & RowCount & ":Q" & RowCount).Copy DestSht.Range("A" & NewRow).PasteSpeial _ Paste:=xlPasteValues RPLSht.Range("P" & RowCount).Copy DestSht.Range("Y" & NewRow).PasteSpeial _ Paste:=xlPasteValues Next RowCount RPLbk.Close savechanges:=True FName = Dir() Loop End Sub -- joel ------------------------------------------------------------------------ joel's Profile: 229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=190719 http://www.thecodecage.com/forumz |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can you create a folder in Excel workbook to hold related sheets? | Excel Discussion (Misc queries) | |||
copy&paste of several sheets in a folder to a workbook with somesh | Excel Programming | |||
Open and copy all workbook sheets in a folder to a master file | Excel Discussion (Misc queries) | |||
how can I sort sheets within a workbook in excel | Excel Worksheet Functions | |||
Sort to Various Sheets in Workbook | Excel Programming |