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: 2,824
Default Toggle True/False in a cell

How about this:

Option Explicit

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
Cancel As Boolean)

If Target.Cells.Count 1 Then Exit Sub
If Target.Column < 7 Then Exit Sub

On Error GoTo errHandler:
Application.EnableEvents = False
Cancel = True
If TypeName(Target.Value) = "Boolean" Then
Target.Value = Not Target.Value
ElseIf IsEmpty(Target.Value) Then
Target.Value = True
End If

errHandler:
Application.EnableEvents = True

End Sub

Rightclick on the the worksheet tab that should have this behavior. Select View
Code and paste this in.

The macro looks for a rightclick when you're in column 7 (G). Modify that if
required.

Herold Winter wrote:

Hello,

I would like to know if the following is possible:

If you click on a cell the value will toggle between true or false.
I want to add a column which has that kind of cells.
I want to use it for marking purposes.

Sorry, for my bad englisch

--
Herold Winter


--

Dave Peterson

 
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
Is Cell D3 within 10% of B3 True or false? Mark B Excel Discussion (Misc queries) 13 September 16th 09 11:14 AM
Is Cell D3 within 10% of B3 True or false? Mark B Excel Discussion (Misc queries) 6 September 15th 09 04:29 PM
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
Function to return True/False if all are validated as True by ISNU Tetsuya Oguma Excel Worksheet Functions 2 March 15th 06 10:28 AM
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


All times are GMT +1. The time now is 04:31 PM.

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"