Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default How can I detect that an excel cell has been clicked

I have a vb.net app which includes an excel sheet. I need to detect when a
cell has been clicked but there does not appear to be an appropriate event to
handle.

So far I have handled the "XLSheet.SelectionChange" event to achieve my
requirements BUT if the cell in question is ALREADY selected, clicking on it
will not raise the above event. I have to click elsewhere so that the
selection changes, the result being that data is added to the worksheet in
the "wrong" cell.

Am I missing something that should be really obvious?

I am using vb.net express (2008) and Office 2007 (interop).



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default How can I detect that an excel cell has been clicked

In 2003, there is a Worksheet_SelectionChange that triggers when a cell is
selected.
--
HTH,
Barb Reinhardt



"Ballantine" wrote:

I have a vb.net app which includes an excel sheet. I need to detect when a
cell has been clicked but there does not appear to be an appropriate event to
handle.

So far I have handled the "XLSheet.SelectionChange" event to achieve my
requirements BUT if the cell in question is ALREADY selected, clicking on it
will not raise the above event. I have to click elsewhere so that the
selection changes, the result being that data is added to the worksheet in
the "wrong" cell.

Am I missing something that should be really obvious?

I am using vb.net express (2008) and Office 2007 (interop).



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default How can I detect that an excel cell has been clicked

Never mind. YOu've already looks at SelectionChange. From what I've seen,
it needs to be freshly selected to trigger the event.
--
HTH,
Barb Reinhardt



"Ballantine" wrote:

I have a vb.net app which includes an excel sheet. I need to detect when a
cell has been clicked but there does not appear to be an appropriate event to
handle.

So far I have handled the "XLSheet.SelectionChange" event to achieve my
requirements BUT if the cell in question is ALREADY selected, clicking on it
will not raise the above event. I have to click elsewhere so that the
selection changes, the result being that data is added to the worksheet in
the "wrong" cell.

Am I missing something that should be really obvious?

I am using vb.net express (2008) and Office 2007 (interop).



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default How can I detect that an excel cell has been clicked

Thanks for showing some interest and very promptly too. Unfortunately you
are only telling me what I already know. Hopefully someone else will have
come across the same issue and will tell us how they overcame it.

"Barb Reinhardt" wrote:

Never mind. YOu've already looks at SelectionChange. From what I've seen,
it needs to be freshly selected to trigger the event.
--
HTH,
Barb Reinhardt



"Ballantine" wrote:

I have a vb.net app which includes an excel sheet. I need to detect when a
cell has been clicked but there does not appear to be an appropriate event to
handle.

So far I have handled the "XLSheet.SelectionChange" event to achieve my
requirements BUT if the cell in question is ALREADY selected, clicking on it
will not raise the above event. I have to click elsewhere so that the
selection changes, the result being that data is added to the worksheet in
the "wrong" cell.

Am I missing something that should be really obvious?

I am using vb.net express (2008) and Office 2007 (interop).



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default How can I detect that an excel cell has been clicked

After you trigger the selection change event, could you do something like
this so you could select the same cell again

Application.EnableEvents = FALSE
Target.parent.cells(1,1).select
Application.EnableEvents = TRUE
--
HTH,
Barb Reinhardt



"Ballantine" wrote:

Thanks for showing some interest and very promptly too. Unfortunately you
are only telling me what I already know. Hopefully someone else will have
come across the same issue and will tell us how they overcame it.

"Barb Reinhardt" wrote:

Never mind. YOu've already looks at SelectionChange. From what I've seen,
it needs to be freshly selected to trigger the event.
--
HTH,
Barb Reinhardt



"Ballantine" wrote:

I have a vb.net app which includes an excel sheet. I need to detect when a
cell has been clicked but there does not appear to be an appropriate event to
handle.

So far I have handled the "XLSheet.SelectionChange" event to achieve my
requirements BUT if the cell in question is ALREADY selected, clicking on it
will not raise the above event. I have to click elsewhere so that the
selection changes, the result being that data is added to the worksheet in
the "wrong" cell.

Am I missing something that should be really obvious?

I am using vb.net express (2008) and Office 2007 (interop).





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default How can I detect that an excel cell has been clicked

Thanks again, Barb. Your suggestion is useful. However, since the
worksheets being used by my app might reasonably have 200+ x 200+ used cells
I don't want to navigate away from the most recently selected cell.
Obviously I could use a "nearby" cell but this workaround starts to get
over-complicated when you apply logic to determine an appropriate cell to
select - I don't want the range of cells being displayed to change.

I must admit, however, that I didn't think of turning event handling off/on.
Far too obvious for me!!!

"Barb Reinhardt" wrote:

After you trigger the selection change event, could you do something like
this so you could select the same cell again

Application.EnableEvents = FALSE
Target.parent.cells(1,1).select
Application.EnableEvents = TRUE
--
HTH,
Barb Reinhardt



"Ballantine" wrote:

Thanks for showing some interest and very promptly too. Unfortunately you
are only telling me what I already know. Hopefully someone else will have
come across the same issue and will tell us how they overcame it.

"Barb Reinhardt" wrote:

Never mind. YOu've already looks at SelectionChange. From what I've seen,
it needs to be freshly selected to trigger the event.
--
HTH,
Barb Reinhardt



"Ballantine" wrote:

I have a vb.net app which includes an excel sheet. I need to detect when a
cell has been clicked but there does not appear to be an appropriate event to
handle.

So far I have handled the "XLSheet.SelectionChange" event to achieve my
requirements BUT if the cell in question is ALREADY selected, clicking on it
will not raise the above event. I have to click elsewhere so that the
selection changes, the result being that data is added to the worksheet in
the "wrong" cell.

Am I missing something that should be really obvious?

I am using vb.net express (2008) and Office 2007 (interop).



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
VB ; How do I detect a Comment in a cell rdwj Excel Discussion (Misc queries) 5 June 4th 08 09:17 PM
HOW DO I GET AN X IN A CELL IN EXCEL TO COME & GO WHEN CLICKED carbetboy Excel Discussion (Misc queries) 3 March 22nd 08 11:21 PM
How to detect characters in cell? Eric Excel Discussion (Misc queries) 1 November 10th 07 02:02 PM
Can I format a cell to fill red when clicked with mouse (Excel)? mike.wilson Excel Worksheet Functions 4 May 2nd 05 08:01 AM
Is there a function to detect changes in any given cell? Detecting Cell Value Changes Excel Worksheet Functions 1 January 2nd 05 11:16 PM


All times are GMT +1. The time now is 05:44 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"