ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I put this macro on a EXCEL sheet? (https://www.excelbanter.com/excel-discussion-misc-queries/73627-how-do-i-put-macro-excel-sheet.html)

roger_home

How do I put this macro on a EXCEL sheet?
 

I want to put this macro on a file...it is suppose to make a cell a
check box...where do I put it?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo sub_exit
If Not Intersect(Target, Range("A1")) Is Nothing Then
With Target
If .Value = "ü" Then
.Value = ""
Else
.Value = "ü"
.Font.Name = "Wingdings"
End If
End With
End If
sub_exit:
Application.EnableEvents = True
End Sub


--
roger_home
------------------------------------------------------------------------
roger_home's Profile: http://www.excelforum.com/member.php...o&userid=16434
View this thread: http://www.excelforum.com/showthread...hreadid=516046


wdjsxj

How do I put this macro on a EXCEL sheet?
 
view/toolbars/activex select checkbox and click on the sheet
right click the checkbox select code
roger_home编写:


I want to put this macro on a file...it is suppose to make a cell a
check box...where do I put it?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo sub_exit
If Not Intersect(Target, Range("A1")) Is Nothing Then
With Target
If .Value = "ü" Then
.Value = ""
Else
.Value = "ü"
.Font.Name = "Wingdings"
End If
End With
End If
sub_exit:
Application.EnableEvents = True
End Sub


--
roger_home
------------------------------------------------------------------------
roger_home's Profile: http://www.excelforum.com/member.php...o&userid=16434
View this thread: http://www.excelforum.com/showthread...hreadid=516046




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

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