Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks again Bob for the follow up. I dont have a GetData Sub.
The other codes as given below. For testing purposes I had 3 files, Test2.xls, Test3.xls, Test4.xls with just some numbers A2:D6, D2 having 1 to 5 only. The main file had sheets 1, Consol, 5,6,7 What I am attempting is to copy Range A1:D6 from a range of closed files one At a time to Consol!A2. Check for value of D2. If 1 copy the contents to Sheet5, PasteSpecial Add, If 2 to Sheet6,PasteSpecial Add, If 3 to Sheet7 and so on. The paste range of all destination sheets will have to be cleared of historic values at the start of the process. As such Consol need not be deleted and and a new Worksheet entered and renamed. The existing code does that because I adapted (through hours of trial and error) Ron de Bruins to copy data from closed files. His original code copys the data from the closed files (which is a VERY BIG HELP) sequentially downwards in a sheet which I named Consol. My desire is to sum the values copied according to different data type, hence the checking in D2. I could use the Paste Link, but I have over 70 source files. Sub CopyToSh5() ' ' CopyToSh5 Macro ' Macro recorded 11/12/2005 by Robert ' ' Sheets("Consol").Select Range("A1:D6").Select Selection.Copy Sheets("Sheet5").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _ :=False, Transpose:=False End Sub Sub CopyToSh6() ' ' CopyToSh6 Macro ' Macro recorded 11/14/2005 by Robert ' Sheets("Consol").Select Range("A1:D6").Select Selection.Copy Sheets("Sheet6").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _ :=False, Transpose:=False End Sub Sub CopyToSh7() ' ' CopyToSh7 Macro ' Macro recorded 11/14/2005 by Robert ' Sheets("Consol").Select Range("A1:D6").Select Selection.Copy Sheets("Sheet7").Select Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlAdd, SkipBlanks _ :=False, Transpose:=False End Sub Sub DeleteConsol() ' ' DeleteConsol Macro ' Macro recorded 11/12/2005 by Robert ' ' Sheets("Consol").Select ActiveWindow.SelectedSheets.Delete Sheets("Sheet5").Select Range("A1:D7").Select Selection.Clear Sheets("Sheet6").Select Range("A1:D7").Select Selection.Clear Sheets("Sheet7").Select Range("A1:D7").Select Selection.Clear Sheets("Sheet2").Select End Sub ======================================== Regards -- Robert |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying cell value to master report file which is closed? | Excel Worksheet Functions | |||
Copying From Closed Workbooks | Excel Worksheet Functions | |||
closed files | Excel Programming | |||
Testing Closed Files | Excel Programming | |||
Copying Data from closed workbooks | Excel Programming |