ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Unchecking check boxes on exit (https://www.excelbanter.com/excel-discussion-misc-queries/71482-unchecking-check-boxes-exit.html)

Brisbane Rob

Unchecking check boxes on exit
 

I assume there must be a way of unchecking all checkboxes on exit but I
can't find it. VBA code? Anyone know?

Thanks


--
Brisbane Rob
------------------------------------------------------------------------
Brisbane Rob's Profile: http://www.excelforum.com/member.php...o&userid=25096
View this thread: http://www.excelforum.com/showthread...hreadid=512179


Dave Peterson

Unchecking check boxes on exit
 
I'd uncheck them the next time the workbook opens. It makes life easier.

Where are the checkboxes (on a single worksheet?)

How were they created (from the Forms toolbar or the control toolbox toolbar)

Option Explicit
Sub auto_open()
Dim wks As Worksheet
Dim OLEObj As OLEObject

Set wks = Worksheets("sheet1")

If wks.CheckBoxes.Count 0 Then
wks.CheckBoxes.Value = xlOff
End If

For Each OLEObj In wks.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
OLEObj.Object.Value = False
End If
Next OLEObj
End Sub



Brisbane Rob wrote:

I assume there must be a way of unchecking all checkboxes on exit but I
can't find it. VBA code? Anyone know?

Thanks

--
Brisbane Rob
------------------------------------------------------------------------
Brisbane Rob's Profile: http://www.excelforum.com/member.php...o&userid=25096
View this thread: http://www.excelforum.com/showthread...hreadid=512179


--

Dave Peterson

Brisbane Rob

Unchecking check boxes on exit
 

Thanks very much apprecited


--
Brisbane Rob
------------------------------------------------------------------------
Brisbane Rob's Profile: http://www.excelforum.com/member.php...o&userid=25096
View this thread: http://www.excelforum.com/showthread...hreadid=512179



All times are GMT +1. The time now is 02:31 PM.

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