Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VB ; How do I detect a Comment in a cell | Excel Discussion (Misc queries) | |||
HOW DO I GET AN X IN A CELL IN EXCEL TO COME & GO WHEN CLICKED | Excel Discussion (Misc queries) | |||
How to detect characters in cell? | Excel Discussion (Misc queries) | |||
Can I format a cell to fill red when clicked with mouse (Excel)? | Excel Worksheet Functions | |||
Is there a function to detect changes in any given cell? | Excel Worksheet Functions |