Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default copy selected cells to new workbook?

hi

This is the workflow which I am trying to achieve:

a. The user selecets multiple cells using the mouse
b. I have a com based plugin which adds a button to excel
c. On cliking of button I copy the the selected cells to new workbook.

How do I get the the selected cells and copy them to the clipboard?

Regards
Chimanrao

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default copy selected cells to new workbook?

Try

Selection.Copy

Note that many operations clear the clipboard, so you want to do
the Copy operation as close as possible to the Paste. Ideally,
the Copy and Paste operations will be on sequential lines of
code.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chimanrao" wrote in message
ups.com...
hi

This is the workflow which I am trying to achieve:

a. The user selecets multiple cells using the mouse
b. I have a com based plugin which adds a button to excel
c. On cliking of button I copy the the selected cells to new
workbook.

How do I get the the selected cells and copy them to the
clipboard?

Regards
Chimanrao



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default copy selected cells to new workbook?

I should have added that you can bypass the clipboard entirely by
specifying a destination in the Copy method. E.g.,

Selection.Copy
destination:=Workbooks("Book2.xls").Worksheets("Sh eet1").Range("A1")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chip Pearson" wrote in message
...
Try

Selection.Copy

Note that many operations clear the clipboard, so you want to
do the Copy operation as close as possible to the Paste.
Ideally, the Copy and Paste operations will be on sequential
lines of code.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chimanrao" wrote in message
ups.com...
hi

This is the workflow which I am trying to achieve:

a. The user selecets multiple cells using the mouse
b. I have a com based plugin which adds a button to excel
c. On cliking of button I copy the the selected cells to new
workbook.

How do I get the the selected cells and copy them to the
clipboard?

Regards
Chimanrao





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default copy selected cells to new workbook?

An unfortunate line wrap problem.

Chip's code goes on one line or use a continuation character so that it's still
one logical line:

Selection.Copy _
destination:=Workbooks("Book2.xls").Worksheets("Sh eet1").Range("A1")



Chip Pearson wrote:

I should have added that you can bypass the clipboard entirely by
specifying a destination in the Copy method. E.g.,

Selection.Copy
destination:=Workbooks("Book2.xls").Worksheets("Sh eet1").Range("A1")

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Chip Pearson" wrote in message
...
Try

Selection.Copy

Note that many operations clear the clipboard, so you want to
do the Copy operation as close as possible to the Paste.
Ideally, the Copy and Paste operations will be on sequential
lines of code.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chimanrao" wrote in message
ups.com...
hi

This is the workflow which I am trying to achieve:

a. The user selecets multiple cells using the mouse
b. I have a com based plugin which adds a button to excel
c. On cliking of button I copy the the selected cells to new
workbook.

How do I get the the selected cells and copy them to the
clipboard?

Regards
Chimanrao




--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default copy selected cells to new workbook?

Do the COM interfaces accept the destination?
I am using VC++.

Regards
Chimanrao



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default copy selected cells to new workbook?

Chip????


Chimanrao wrote:

Do the COM interfaces accept the destination?
I am using VC++.

Regards
Chimanrao


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default copy selected cells to new workbook?

They should, but I don't know for sure.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chimanrao" wrote in message
ups.com...
Do the COM interfaces accept the destination?
I am using VC++.

Regards
Chimanrao



Reply
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
Make copy of workbook based on selected criteria Anthony[_5_] Excel Worksheet Functions 3 March 30th 10 10:57 PM
Cannot copy selected cells Stevie Excel Discussion (Misc queries) 1 February 19th 10 06:06 PM
copy selected tabs from multiple workbooks to a new workbook chris Excel Worksheet Functions 0 July 12th 07 03:46 PM
how can I duplicate or copy a workbook then divide selected cells. macros excel... duplication and calculat Excel Discussion (Misc queries) 1 November 29th 04 03:16 PM
Copy selected data to new workbook Pete[_8_] Excel Programming 3 July 19th 03 01:24 AM


All times are GMT +1. The time now is 11:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"