ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   checkbox (https://www.excelbanter.com/excel-programming/364654-checkbox.html)

april27

checkbox
 
how do use write code so that a checkbox is selected when the program begins?

Bob Phillips

checkbox
 
Assuming that it is a Forms checkbox

Private Sub Workbook_Open()
Worksheets("Sheet1").CheckBoxes("Check Box 2").Value = 1
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

--
HTH

Bob Phillips

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

"april27" wrote in message
...
how do use write code so that a checkbox is selected when the program

begins?



Norman Jones

checkbox
 
Hi Apil27,

Assuming that the checkbox is on a userform, as might be implied by some of
your earlier posts, try:

'=============
Private Sub UserForm_Initialize()
Me.CheckBox1.SetFocus
End Sub
'<<=============


---
Regards,
Norman


"april27" wrote in message
...
how do use write code so that a checkbox is selected when the program
begins?





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

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