Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
xk xk is offline
external usenet poster
 
Posts: 7
Default How to cancel the selection?

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How to cancel the selection?

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
xk xk is offline
external usenet poster
 
Posts: 7
Default How to cancel the selection?

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default How to cancel the selection?

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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How to cancel the selection?

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





  #6   Report Post  
Posted to microsoft.public.excel.programming
xk xk is offline
external usenet poster
 
Posts: 7
Default How to cancel the selection?

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
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
Workbook_BeforeClose(Cancel As Boolean) - Cancel won't work gpmichal Setting up and Configuration of Excel 1 May 12th 09 02:33 AM
Input box to cancel sub when Cancel is clicked. PCLIVE Excel Programming 5 September 5th 06 03:19 PM
Disabling 'Cancel' option when saving work (Yes/No/Cancel) [email protected] Excel Programming 0 July 11th 06 09:28 PM
Cancel button to cancel the whole macro excelnut1954 Excel Programming 3 January 17th 06 08:27 PM
Cancel Macro is user selects 'cancel' at save menu Mark Excel Programming 1 April 6th 05 05:45 PM


All times are GMT +1. The time now is 03:34 AM.

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

About Us

"It's about Microsoft Excel"