Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maria
The GotFocus Event is automatically triggered when you select the button by clicking on it. So, before the Click event fires, the GotFocus should fire. The "how to find out what is selected." is done by telling your routine what is selected. Every Object will have its own GotFocus Code - Not just one for the whole sheet - so each one tells the General Routine which button it is" Eg CommandButton1_GorFocus() Run "MyGeneralCheckingRoutine", "CommandButton1" Eg CommandButton2_GorFocus() Run "MyGeneralCheckingRoutine", "CommandButton2" Eg TextBox1_GorFocus() Run "MyGeneralCheckingRoutine", "TextBox1" Eg CommandButton3_GorFocus() Run "MyGeneralCheckingRoutine", "CommandButton3" Nick "Maria J-son" wrote: Hi and thanks, I'll look more into how to trig it. Now, more important is the actual checking routine - how to find out what is selected. /Regards "Nicholas B" skrev i meddelandet ... Maria As far as I can see the WorkSheet Selection Change only works with changes to cells, it doesn't seem to fire as you chose different buttons. To get around this I suggest you use the GotFocus Event of each object (TextBox, CommandButton, etc) Write something into the GotFocus Method that fires a common checking routine Eg Private Sub CommandButton1_GotFocus() Run "MyGeneralCheckingRoutine", "CommandButton1" End Sub Your Checking Routine is then being told which Object has been selected and you can act on that Hope this helps Nick "Maria J-son" wrote: Hi, To a routine, I need to know what is selected on worksheet_change and worksheet_selectionchange. I need It to take different actions depending on the type... Selections could be like Cells Buttons CheckBoxes TextBox Worksheets ChartObjects Most important right now is to find if it is a button selected (in the shapes collection i think, not OLE). The other types in the list will soon come to, however. Can somebody please share a good routine for this? /Regards |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple cells or columns are selected instead of selected cell or | Excel Discussion (Misc queries) | |||
Cells are selected but aren't displayed as selected | Excel Discussion (Misc queries) | |||
Cells are selected but aren't displayed as selected | Excel Worksheet Functions | |||
Macro to take selected cells times a selected cell | Excel Programming | |||
how do i make it so that when a sheat is selected either via link or tab, that xlLastCell is selected. the last on the sheet. | Excel Worksheet Functions |