ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   ActiveX controls (https://www.excelbanter.com/excel-discussion-misc-queries/116172-activex-controls.html)

Luke

ActiveX controls
 
Hi
Is it possible to designate a cell as a control box and link a macro to it
rather than using one of the ActiveX controls?

Many thanks

Bob Phillips

ActiveX controls
 
If you don't want an ACtiveX control, you could use a checkbox from the
Forms toolbar.

An alternative is this methiod which is invoked by selecting a cell

'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.



Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "H10" '<=== change to suit

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value = "a" Then
.Value = ""
Else
.Value = "a"
End If
.Font.Name = "Marlett"
.Offset(0, 1).Activate
End With
End If
End Sub


--
HTH

Bob Phillips

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

"Luke" wrote in message
...
Hi
Is it possible to designate a cell as a control box and link a macro to it
rather than using one of the ActiveX controls?

Many thanks





All times are GMT +1. The time now is 07:24 AM.

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