PDA

View Full Version : A quick copy/paste question



Peskarik
02-01-2008, 03:50 AM
Say I have two files in the same directory (say, C:\Data)
File 1 is open, File 2 is closed.

How can I copy say a range of values from sheet 1 of File 1:
ThisWorkbook.Worksheets(1).Range("A1", Range("A1").End(xlDown))

to File 2, Sheet 2, Range (from "B2" down)

without opening File 2?
:dau:

Bob Phillips
02-01-2008, 03:59 AM
Using ADO, but much simpler to open it, copy it, and close it.

Peskarik
02-01-2008, 04:29 AM
Using ADO, but much simpler to open it, copy it, and close it.

So basically, that is Macro Recorder way of doing things. :think:

Bob Phillips
02-01-2008, 08:22 AM
Not sure what you mean there?

PhilJette
02-01-2008, 11:09 AM
as mentioned by XLD the easiest way will be to copy the range, open the file, paste it and close it.
If you want this to happen "Bedind the scenes" you can use:

application.screenupdating = false
application.displayalerts = false
'CODE HERE
application.screenupdating = true
application.displayalerts = true

Peskarik
02-03-2008, 09:25 AM
as mentioned by XLD the easiest way will be to copy the range, open the file, paste it and close it.
If you want this to happen "Bedind the scenes" you can use:

application.screenupdating = false
application.displayalerts = false
'CODE HERE
application.screenupdating = true
application.displayalerts = true


I have just read this part in the book. :yes
What I mean by "Recorder way" is copy-open-paste-close.
Anyway, thanks guys! :bow: