LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Ctrl-Click to change TRUE and FALSE in a cell

If you hold the control-key when you select a cell, then one area will be added to the current selection even if you control-click on the activecell.

This behaviour can be used to do something cool: ctrl-click on a cell to flip TRUE and FALSE. You can use the SheetSelectionChange event of the workbook to accomplish this.

Here is the code to insert in the code module of the workbook:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Areas.Count = 2 Then
If Target.Areas(2).Cells.Count = 1 Then
If TypeName(Target.Areas(2).Value) = "Boolean" Then
Target.Areas(2).Value = Not Target.Areas(2).Value
Target.Areas(2).Select
End If
End If
End If
End Sub
 
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
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Excel Discussion (Misc queries) 9 July 29th 08 12:28 AM
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu LunaMoon Excel Programming 9 July 29th 08 12:28 AM
TRUE/FALSE BOX not activating a WS change Jase Excel Discussion (Misc queries) 1 April 11th 08 07:42 PM
Use IF to change value in a different cell when TRUE (or FALSE)? Ricter Excel Discussion (Misc queries) 2 February 8th 06 11:54 PM
A procedure should run when one cell switch between false/true - but not with worksheet_calculate or change event... Gunnar Johansson Excel Programming 3 October 19th 04 05:24 PM


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