Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Programming a checkbox in Excel

On May 23, 10:56 am, Tom Ogilvy
wrote:
right click on the sheet tab. Select View code. In the left dropdown at the
top of the module select Worksheet and on the right dropdown select
BeforeDoubleclick.

this will put in a code declaration for the Beforedoubleclick event.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)

End Sub

This event will fire whenever the sheet is double clicked, before the normal
action of the double click is executed. The cancel argument allows you to
cance that normal action. Now you need to add code to perform the function
you want whenever the cell triggering the event (held as a reference in the
target variable) is the cell you are interested in. For example for cell F9
to have this functionality

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Address = "$F$9" Then
Cancel = True
Target.Font.ColorIndex = 3
If Trim(LCase(Target.Value)) = "x" Then
Target.ClearContents
Else
Target.Value = "X"
End If
End If
End Sub

Make sure you only have one BeforeDoubleClick event in your sheet module.

--
Regards,
Tom Ogilvy



" wrote:
Hello, I am very unfamiliar with programming VB and Macros in excel.
Here is the situation.


I would like to have a check or an "X" appear in a cell when it is
double clicked.


Can someone please help me with that? Thank you!


Lauren- Hide quoted text -


- Show quoted text -


Thank you! That worked beautifully

Reply
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
Programming a checkbox in Excel [email protected] Excel Programming 1 May 23rd 07 03:56 PM
link a checkbox in a sheet to a checkbox on a userform? Arjan Excel Programming 0 November 10th 06 01:37 PM
How do I link one checkbox to update another checkbox? Mike Excel Programming 3 April 28th 06 02:22 AM
checkbox on form reset from checkbox on sheet raw[_12_] Excel Programming 1 December 3rd 05 05:08 AM
programming checkbox properties mark Excel Programming 5 August 6th 04 11:26 PM


All times are GMT +1. The time now is 07:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"