LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Copying from closed files and IF statement

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
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
Copying cell value to master report file which is closed? Kevin Excel Worksheet Functions 3 April 8th 07 07:07 PM
Copying From Closed Workbooks Mike Excel Worksheet Functions 3 September 6th 06 06:33 PM
closed files dh13134[_2_] Excel Programming 0 October 4th 05 10:29 PM
Testing Closed Files Paul W Smith[_2_] Excel Programming 1 November 6th 03 04:04 PM
Copying Data from closed workbooks Kevin G Excel Programming 4 July 31st 03 03:46 PM


All times are GMT +1. The time now is 09:24 AM.

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"