ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Taking focus off a Control Checkbox (https://www.excelbanter.com/excel-programming/282123-taking-focus-off-control-checkbox.html)

Don Wiss

Taking focus off a Control Checkbox
 
I prefer the checkboxes that are on the Forms menu, but they don't allow
for move and size with cells. At least not in Excel 97. So when I have an
application where I hide rows, and I also want to have the checkboxes hide,
I have to use the checkboxes from the Control Menu.

But this creates a bunch of problems. If someone clicks on one, the focus
remains on the control. If one then tries to Unprotect the sheet it
crashes. So I error trap this and place the cursor somewhere on the sheet.
But now I find that I can't Unhide rows with the focus on the control. Now
before I write more and more error handlers, I figure there must be a
better way. Some macro code that puts the focus back on the cell that was
active before checking would be ideal, but when code is run for a control
the Activecell.Name is undefined.

Thanks, Don <donwiss at panix.com.

Tom Ogilvy

Taking focus off a Control Checkbox
 
At the top of each event procedure

ActiveCell.Activate

or

Selection.Select

--
Regards,
Tom Ogilvy


Don Wiss wrote in message
...
I prefer the checkboxes that are on the Forms menu, but they don't allow
for move and size with cells. At least not in Excel 97. So when I have an
application where I hide rows, and I also want to have the checkboxes

hide,
I have to use the checkboxes from the Control Menu.

But this creates a bunch of problems. If someone clicks on one, the focus
remains on the control. If one then tries to Unprotect the sheet it
crashes. So I error trap this and place the cursor somewhere on the sheet.
But now I find that I can't Unhide rows with the focus on the control. Now
before I write more and more error handlers, I figure there must be a
better way. Some macro code that puts the focus back on the cell that was
active before checking would be ideal, but when code is run for a control
the Activecell.Name is undefined.

Thanks, Don <donwiss at panix.com.





All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com