View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ron ron is offline
external usenet poster
 
Posts: 20
Default de-select range in other workbook?

Thanks. Well, I tried it but the copied data was still
highlighted. I think

Application.CutCopyMode = False

only works if it is called in the same workbook as the
highlighted data. I tried running that statement from
another workbook. My alternative would be to write the
data to the sheets in the 2nd workbook (like 1500 rows)
like with a range object. But that would take way longer
than just copy and paste. I may just have to live with
this. My problem is that I am using Excel97 and pulling
data from Sql Server 2k and so can't use CopyFromRecordset
with the ADO recordset. Wait, I just had an idea, I will
pull the data to my ADO recordset and then copy that data
to a DAO recordset and then I can use copyfromrecordset
with the dao recordset. Hope that's as fast as copy and
paste with the DataObject thing I've been using.


-----Original Message-----
Hi Ron,

After your paste operation add the line:

Application.CutCopyMode = False

---
Regards,
Norman



"Ron" wrote in

message
...
Greetings,

I am copying data from one workbook (book1) to another
(book2) like this:

Dim sht As Worksheet
Set sht = Workbooks("Book2").Sheets("Sheet1")
sht.Range("B10:H20").PasteSpecial


So when I go to Book2 I see the data but it is all
highlighted. I tried de-selecting it by saying

sht.Range("A1").Select

after the PastSpecial statement, but that gave me an

error
message that the selection failed. Is there a way to do
this in code to de-select a range in a workbook from
another workbook?

Thanks,
Ron



.