ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating macro in Excel that can add a check mark (https://www.excelbanter.com/excel-programming/366963-creating-macro-excel-can-add-check-mark.html)

marina1072

Creating macro in Excel that can add a check mark
 
There is a Macro found in Word (see fax sheet template) that will create a
check mark in a box if you double click on the box. Does anyone know how
translate this macro into Excel?

I am using Word 97 SR-2 (behind the times a bit....)

[email protected]

Creating macro in Excel that can add a check mark
 
Why not just use a checkbox from the forms toolbar?
marina1072 wrote:
There is a Macro found in Word (see fax sheet template) that will create a
check mark in a box if you double click on the box. Does anyone know how
translate this macro into Excel?

I am using Word 97 SR-2 (behind the times a bit....)



Bob Phillips

Creating macro in Excel that can add a check mark
 
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Const WS_RANGE As String = "H1:H10"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value = "a" Then
.Value = ""
Else
.Value = "a"
.Font.Name = "Marlett"
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.





--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"marina1072" wrote in message
...
There is a Macro found in Word (see fax sheet template) that will create a
check mark in a box if you double click on the box. Does anyone know how
translate this macro into Excel?

I am using Word 97 SR-2 (behind the times a bit....)





All times are GMT +1. The time now is 01:11 AM.

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