Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2008, 09:12 AM
Authorized User
 
Join Date: Aug 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to remember a copied range

Hi
I have written a macro for end-users to run on their PCs but each time they do so it means that the CutCopyMoode resets to false and they have to re-copy any area they had copied beforehand. I want my macro to remember any area that they may have previously copied so that I can reinstate the Copy mode once the macro has finished.
I would assume the idea would go something like:

If Application.CutCopyMode = xlcopy then
     CopyArea = ..... 'Remember copied area outlined in moving dashes
else
     CopyArea = ""
endif
     Call MainMacro
     if CopyArea <> "" then Range(CopyArea).Copy 'Reinstate copied area

Can anyone fill in the dots in my above macro?


 
Old September 2nd, 2008, 12:09 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Can you try the following:

If Application.CutCopyMode = xlcopy then
     CopyArea = Selection
End if

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old September 2nd, 2008, 12:55 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

 Hi

Can you try the following:

If Application.CutCopyMode = xlcopy then
     CopyArea = Application.Selection
End if

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Folder files not being copied John Leo Visual Studio 2005 0 May 14th, 2008 08:21 AM
XSLT: Empty elements not copied Borg0011 XSLT 0 July 18th, 2006 06:57 AM
Copied Configuration Settings but Doesn't build oolatin79 Visual C++ 1 July 17th, 2006 07:04 PM
Database Access (copied from books forum) Mistoffeles C# 0 November 21st, 2005 04:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.