PC Review


Reply
Thread Tools Rate Thread

How to cancel the selection?

 
 
=?Utf-8?B?eGs=?=
Guest
Posts: n/a
 
      8th Nov 2006
Hi,

I'm coding as the below lines to do copy some cells from one sheet to
another sheet

sheets(sheet1).Range(cell1:cell2),select
copy selection .... paste special .... etc

it works . but after that it goes to the orginal sheet and the selection
shinning line box still on the selection range. I'd like to not showing this
selection line after.

I tried selection .clear, but it just cleared all the content for the
selection, but I just want to cancel the selection

Is there anyone who can give the idea? Very appreicate for any help



 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      8th Nov 2006
Give this a try... It stores the original cell and sheet where the macro
started and then returns to that sheet and cell when the macro completes.

Sub Whatever()
dim rngOriginal as range
dim wksOriginal as Worksheet

set wksOriginal = activesheet
set rngoriginal = activecell
'Do your stuff

wksOriginal.Select
rngoriginal.Select
End Sub
--
HTH...

Jim Thomlinson


"xk" wrote:

> Hi,
>
> I'm coding as the below lines to do copy some cells from one sheet to
> another sheet
>
> sheets(sheet1).Range(cell1:cell2),select
> copy selection .... paste special .... etc
>
> it works . but after that it goes to the orginal sheet and the selection
> shinning line box still on the selection range. I'd like to not showing this
> selection line after.
>
> I tried selection .clear, but it just cleared all the content for the
> selection, but I just want to cancel the selection
>
> Is there anyone who can give the idea? Very appreicate for any help
>
>
>

 
Reply With Quote
 
=?Utf-8?B?eGs=?=
Guest
Posts: n/a
 
      8th Nov 2006
Hi, Jim

I put your suggested code in my macro. but it didn't work as expected
And for additional info, I'm copying the cells from one sheet to a new add
sheet.
( I suppose that I can replace with any name for rngOriginal and wksOriginal
when do dim, right?)

Anyway, thanks for suggestion





"Jim Thomlinson" wrote:

> Give this a try... It stores the original cell and sheet where the macro
> started and then returns to that sheet and cell when the macro completes.
>
> Sub Whatever()
> dim rngOriginal as range
> dim wksOriginal as Worksheet
>
> set wksOriginal = activesheet
> set rngoriginal = activecell
> 'Do your stuff
>
> wksOriginal.Select
> rngoriginal.Select
> End Sub
> --
> HTH...
>
> Jim Thomlinson
>
>
> "xk" wrote:
>
> > Hi,
> >
> > I'm coding as the below lines to do copy some cells from one sheet to
> > another sheet
> >
> > sheets(sheet1).Range(cell1:cell2),select
> > copy selection .... paste special .... etc
> >
> > it works . but after that it goes to the orginal sheet and the selection
> > shinning line box still on the selection range. I'd like to not showing this
> > selection line after.
> >
> > I tried selection .clear, but it just cleared all the content for the
> > selection, but I just want to cancel the selection
> >
> > Is there anyone who can give the idea? Very appreicate for any help
> >
> >
> >

 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      8th Nov 2006
try adding this in

Application.CutCopyMode = False

after you've copied & pasted. this will remove the "cut" flashing box
around the selection.
susan


xk wrote:
> Hi, Jim
>
> I put your suggested code in my macro. but it didn't work as expected
> And for additional info, I'm copying the cells from one sheet to a new add
> sheet.
> ( I suppose that I can replace with any name for rngOriginal and wksOriginal
> when do dim, right?)
>
> Anyway, thanks for suggestion
>
>
>
>
>
> "Jim Thomlinson" wrote:
>
> > Give this a try... It stores the original cell and sheet where the macro
> > started and then returns to that sheet and cell when the macro completes.
> >
> > Sub Whatever()
> > dim rngOriginal as range
> > dim wksOriginal as Worksheet
> >
> > set wksOriginal = activesheet
> > set rngoriginal = activecell
> > 'Do your stuff
> >
> > wksOriginal.Select
> > rngoriginal.Select
> > End Sub
> > --
> > HTH...
> >
> > Jim Thomlinson
> >
> >
> > "xk" wrote:
> >
> > > Hi,
> > >
> > > I'm coding as the below lines to do copy some cells from one sheet to
> > > another sheet
> > >
> > > sheets(sheet1).Range(cell1:cell2),select
> > > copy selection .... paste special .... etc
> > >
> > > it works . but after that it goes to the orginal sheet and the selection
> > > shinning line box still on the selection range. I'd like to not showing this
> > > selection line after.
> > >
> > > I tried selection .clear, but it just cleared all the content for the
> > > selection, but I just want to cancel the selection
> > >
> > > Is there anyone who can give the idea? Very appreicate for any help
> > >
> > >
> > >


 
Reply With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      8th Nov 2006
Are you doing any deleting?
--
HTH...

Jim Thomlinson


"xk" wrote:

> Hi, Jim
>
> I put your suggested code in my macro. but it didn't work as expected
> And for additional info, I'm copying the cells from one sheet to a new add
> sheet.
> ( I suppose that I can replace with any name for rngOriginal and wksOriginal
> when do dim, right?)
>
> Anyway, thanks for suggestion
>
>
>
>
>
> "Jim Thomlinson" wrote:
>
> > Give this a try... It stores the original cell and sheet where the macro
> > started and then returns to that sheet and cell when the macro completes.
> >
> > Sub Whatever()
> > dim rngOriginal as range
> > dim wksOriginal as Worksheet
> >
> > set wksOriginal = activesheet
> > set rngoriginal = activecell
> > 'Do your stuff
> >
> > wksOriginal.Select
> > rngoriginal.Select
> > End Sub
> > --
> > HTH...
> >
> > Jim Thomlinson
> >
> >
> > "xk" wrote:
> >
> > > Hi,
> > >
> > > I'm coding as the below lines to do copy some cells from one sheet to
> > > another sheet
> > >
> > > sheets(sheet1).Range(cell1:cell2),select
> > > copy selection .... paste special .... etc
> > >
> > > it works . but after that it goes to the orginal sheet and the selection
> > > shinning line box still on the selection range. I'd like to not showing this
> > > selection line after.
> > >
> > > I tried selection .clear, but it just cleared all the content for the
> > > selection, but I just want to cancel the selection
> > >
> > > Is there anyone who can give the idea? Very appreicate for any help
> > >
> > >
> > >

 
Reply With Quote
 
=?Utf-8?B?eGs=?=
Guest
Posts: n/a
 
      8th Nov 2006
Hi, Susan,

It's exactly the solution what I want. Thanks a lot.

And Jim

I don't delete the orgninal sheet, just use that one to link to the other
workbook and copy the data from this sheet to other sheets.

Thanks both of you for quick reply and idea.



"Susan" wrote:

> try adding this in
>
> Application.CutCopyMode = False
>
> after you've copied & pasted. this will remove the "cut" flashing box
> around the selection.
> susan
>
>
> xk wrote:
> > Hi, Jim
> >
> > I put your suggested code in my macro. but it didn't work as expected
> > And for additional info, I'm copying the cells from one sheet to a new add
> > sheet.
> > ( I suppose that I can replace with any name for rngOriginal and wksOriginal
> > when do dim, right?)
> >
> > Anyway, thanks for suggestion
> >
> >
> >
> >
> >
> > "Jim Thomlinson" wrote:
> >
> > > Give this a try... It stores the original cell and sheet where the macro
> > > started and then returns to that sheet and cell when the macro completes.
> > >
> > > Sub Whatever()
> > > dim rngOriginal as range
> > > dim wksOriginal as Worksheet
> > >
> > > set wksOriginal = activesheet
> > > set rngoriginal = activecell
> > > 'Do your stuff
> > >
> > > wksOriginal.Select
> > > rngoriginal.Select
> > > End Sub
> > > --
> > > HTH...
> > >
> > > Jim Thomlinson
> > >
> > >
> > > "xk" wrote:
> > >
> > > > Hi,
> > > >
> > > > I'm coding as the below lines to do copy some cells from one sheet to
> > > > another sheet
> > > >
> > > > sheets(sheet1).Range(cell1:cell2),select
> > > > copy selection .... paste special .... etc
> > > >
> > > > it works . but after that it goes to the orginal sheet and the selection
> > > > shinning line box still on the selection range. I'd like to not showing this
> > > > selection line after.
> > > >
> > > > I tried selection .clear, but it just cleared all the content for the
> > > > selection, but I just want to cancel the selection
> > > >
> > > > Is there anyone who can give the idea? Very appreicate for any help
> > > >
> > > >
> > > >

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cancel listbox selection vba-dev Microsoft Access VBA Modules 2 26th Oct 2009 10:39 PM
Cancel a listbox selection vba-dev Microsoft Access Form Coding 0 26th Oct 2009 05:16 PM
Re: How to cancel a selection? Rick Rothstein Microsoft Excel Discussion 0 8th Sep 2008 03:26 AM
Re: How to cancel a selection? Dave Peterson Microsoft Excel Discussion 0 8th Sep 2008 03:18 AM
Cancel Mouse Selection DavidW Microsoft Access Form Coding 0 14th Jan 2004 05:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:45 AM.